import java.util.*;

import java.io.*;

public class Main
{

	static long mod=(long)(1e9+7);
	static double PI=3.1415926535;
	public static void main(String[] args) throws IOException
	{

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());

		int n=Integer.parseInt(s.nextToken());
		int m=Integer.parseInt(s.nextToken());
		int a[]=new int[n];
		int b[]=new int[m];

		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
			a[i]=Integer.parseInt(s.nextToken());
		}
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<m;i++) {
			b[i]=Integer.parseInt(s.nextToken());
		}
		shuffleArray(a);
		Arrays.sort(a);

		int ans[]=new int[m];
		for(int i=0;i<b.length;i++) {
			ans[i]=bs(b[i],a)+1;
		}
		for(int i:ans){
			pw.print(i+" ");
		}

		pw.close();

	}
	private static int bs(int val, int[] a) {
		int lo=0;
		int hi=a.length;
		int ans=-1;
		while(lo<hi) {

			int mid=(lo+hi)/2;
			if(a[mid]<=val) {
				lo=mid+1;
				ans=mid;
			}else {
				hi=mid;
			}

		}
		return ans;
	}
	static void shuffleArray(int[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
}

}


import java.util.*;
public class Test{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int n1=s.nextInt();
        int n2=s.nextInt();
        int a[]=new int[n1];
        int b[]=new int[n2];
        int tmp=new int[n2];

        for(int i=0;i<n1;i++){
            a[i]=s.nextInt();
        }
        for(int i=0;i<n2;i++){
            b[i]=s.nextInt();
            tmp[i]=b[i];

        }
        Arrays.sort(a);
        Arrays.sort(tmp);
        HashMap<Integer,Integer>hm=new HashMap<>();
       int ans[]=new int[n2];
        int l1=n1-1;
        int l2=n2-1;
        while(l1>=0 && l2>=0){
            if(a[l1]>tmp[l2])
            l1--;
            else{
                if(!hm.containsKey(tmp[l2]))
                hm.put(tmp[l2],l1+1);

                l2--;
            }
        }
        for(int i=0;i<n2;i++){
            ans[i]=hm.get(b[i]);
        }

        for(int i:ans){
            System.out.print(i+" ");
        }

    }

}


#import java.util.*;
public class Test{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int n1=s.nextInt();
        int n2=s.nextInt();
        int a[]=new int[n1];
        int b[]=new int[n2];

        for(int i=0;i<n1;i++){
            a[i]=s.nextInt();
        }
        for(int i=0;i<n2;i++){
            b[i]=s.nextInt();

        }
        Arrays.sort(a);
       int ans[]=new int[n2];
       for(int i=0;i<n2;i++){
           ans[i]=bSearch(b[i],a);
       }
        for(int i:ans){
            System.out.print(i+" ");
        }

    }
    public static int bSearch(int val,int[] a){
        int s=0;
        int e=a.length-1;
        while(s<=e){
            int mid=(s+e)/2;
            if(a[mid]==val)
            return mid+1;
           else if(a[mid]>val)
           e=mid-1;
           else
           s=mid+1;
        }
        return s;
    }
}


import java.util.*;

import java.io.*;

public class Main
{

	static long mod=(long)(1e9+7);
	static double PI=3.1415926535;
	public static void main(String[] args) throws IOException
	{

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());

		int n=Integer.parseInt(s.nextToken());
		int m=Integer.parseInt(s.nextToken());
		int a[]=new int[n];
		int b[]=new int[m];

		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
			a[i]=Integer.parseInt(s.nextToken());
		}
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<m;i++) {
			b[i]=Integer.parseInt(s.nextToken());
		}
		shuffleArray(a);
		Arrays.sort(a);

		int ans[]=new int[m];
		for(int i=0;i<b.length;i++) {
			ans[i]=bs(b[i],a)+1;
		}
		for(int i:ans){
			pw.print(i+" ");
		}

		pw.close();

	}
	private static int bs(int val, int[] a) {
		int lo=0;
		int hi=a.length;
		int ans=0;
		while(lo<hi) {

			int mid=(lo+hi)/2;
			if(a[mid]<=val) {
				lo=mid+1;
				ans=mid;
			}else {
				hi=mid;
			}

		}
		return ans;
	}
	static void shuffleArray(int[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
}

}


import java.util.*;
public class Test{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int n1=s.nextInt();
        int n2=s.nextInt();
        int a[]=new int[n1];
        int b[]=new int[n2];

        for(int i=0;i<n1;i++){
            a[i]=s.nextInt();
        }
        for(int i=0;i<n2;i++){
            b[i]=s.nextInt();

        }
        Arrays.sort(a);
       int ans[]=new int[n2];
       for(int i=0;i<n2;i++){
           ans[i]=bSearch(b[i],a);
       }
        for(int i:ans){
            System.out.print(i+" ");
        }

    }
    public static int bSearch(int val,int[] a){
        int s=0;
        int e=a.length-1;
        while(s<=e){
            int mid=(s+e)/2;
            if(a[mid]==val)
            return mid+1;
           else if(a[mid]>val)
           e=mid-1;
           else
           s=mid+1;
        }
        return s;
    }
}


import java.util.*;

import java.io.*;

public class Main
{

	static long mod=(long)(1e9+7);
	static double PI=3.1415926535;
	public static void main(String[] args) throws IOException
	{

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());

		int n=Integer.parseInt(s.nextToken());
		int m=Integer.parseInt(s.nextToken());
		int a[]=new int[n];
		int b[]=new int[m];

		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
			a[i]=Integer.parseInt(s.nextToken());
		}
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<m;i++) {
			b[i]=Integer.parseInt(s.nextToken());
		}
		shuffleArray(a);
		Arrays.sort(a);

		int ans[]=new int[m];
		for(int i=0;i<b.length;i++) {
			ans[i]=bs(b[i],a)+1;
		}
		for(int i:ans){
			pw.print(i+" ");
		}

		pw.close();

	}
	private static int bs(int val, int[] a) {
		int lo=0;
		int hi=a.length;
		int ans=-2;
		while(lo<hi) {

			int mid=(lo+hi)/2;
			if(a[mid]<=val) {
				lo=mid+1;
				ans=mid;
			}else {
				hi=mid;
			}

		}
		return ans;
	}
	static void shuffleArray(int[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Objects;
import java.util.TreeMap;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class Main {
    public void exec() {
        int n = stdin.nextInt();
        int m = stdin.nextInt();
        int[] a = stdin.nextIntArray(n);
        int[] b = stdin.nextIntArray(m);

        TreeMap<Integer, Long> t = new TreeMap<>(Arrays.stream(a).boxed().collect(Collectors.groupingBy(Function.identity(), Collectors.counting())));
        List<Integer> keys = t.keySet().stream().sorted().collect(Collectors.toList());
        for (int i = 0; i < keys.size()-1; i++) {
            t.put(keys.get(i+1), t.get(keys.get(i+1)) + t.get(keys.get(i)));
        }

        int[] c = new int[m];
        for (int i = 0; i < m; i++) {
            Integer k = t.floorKey(b[i]);
            if (k == null) {
                c[i] = 0;
            } else {
                c[i] = t.get(k).intValue();
            }
        }

        stdout.println(Arrays.stream(c).mapToObj(Integer::toString).collect(Collectors.joining(" ")));
    }

    private static final Stdin stdin = new Stdin();
    private static final Stdout stdout = new Stdout();

    public static void main(String[] args) {
        new Main().exec();
        stdout.flush();
    }

    public static class Stdin {
        private BufferedReader stdin;
        private Deque<String> tokens;
        private Pattern delim;

        public Stdin() {
            stdin = new BufferedReader(new InputStreamReader(System.in));
            tokens = new ArrayDeque<>();
            delim = Pattern.compile(" ");
        }

        public String nextString() {
            try {
                if (tokens.isEmpty()) {
                    String line = stdin.readLine();
                    delim.splitAsStream(line).forEach(tokens::addLast);
                }
                return tokens.pollFirst();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public String[] nextStringArray(int n) {
            String[] a = new String[n];
            for (int i = 0; i < n; i++) a[i] = nextString();
            return a;
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) a[i] = nextDouble();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }
    }

    public static class Stdout {
        private PrintWriter stdout;

        public Stdout() {
            stdout =  new PrintWriter(System.out, false);
        }

        public void printf(String format, Object ... args) {
            stdout.printf(format, args);
        }

        public void println(Object ... objs) {
            String line = Arrays.stream(objs).map(this::deepToString).collect(Collectors.joining(" "));
            stdout.println(line);
        }

        private String deepToString(Object o) {
            if (o == null || !o.getClass().isArray()) {
                return Objects.toString(o);
            }

            int len = Array.getLength(o);
            String[] tokens = new String[len];
            for (int i = 0; i < len; i++) {
                tokens[i] = deepToString(Array.get(o, i));
            }
            return "{" + String.join(",", tokens) + "}";
        }

        public void flush() {
            stdout.flush();
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int n;
int lb(vi &a , int key) {
    int high = n-1;
    int low = 0;
    int mid;
    int ans = -1;
    while(high >= low) {
        mid = low + (high - low + 1)/2;
        if(a[mid] <= key) {
            ans = max(mid,ans);
            low = mid + 1;

        }
        else if(a[mid] > key) {
            high = mid - 1;
        }
    }

    return ans + 1;
}
int32_t main() {
    fio
    int m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {

        cout <<lb(a,b[j])<< " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int n;
int lb(vi &a , int key) {
    int high = n-1;
    int low = 0;
    int mid;
    int ans = INT_MIN;
    while(high >= low) {
        mid = low + (high - low + 1)/2;
        if(a[mid] <= key) {
            ans = max(mid,ans);
            low = mid + 1;

        }
        else if(a[mid] > key) {
            high = mid - 1;
        }
    }

    return ans + 1;
}
int32_t main() {
    fio
    int m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {

        cout <<lb(a,b[j])<< " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int n;
int lb(vi &a , int key) {
    int high = n-1;
    int low = 0;
    int mid;
    int ans = -1;
    while(high >= low) {
        mid = low + (high - low )/2;
        if(a[mid] <= key) {
            ans = max(mid,ans);
            low = mid + 1;

        }
        else if(a[mid] > key) {
            high = mid - 1;
        }
    }

    return ans + 1;
}
int32_t main() {
    fio
    int m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {

        cout <<lb(a,b[j])<< " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int n;
int lb(vi &a , int key) {
    int high = n-1;
    int low = 0;
    int mid;
    int ans = 0;
    while(high >= low) {
        mid = low + (high - low + 1)/2;
        if(a[mid] <= key) {
            ans = max(mid,ans);
            low = mid + 1;

        }
        else if(a[mid] > key) {
            high = mid - 1;
        }
    }

    return ans + 1;
}
int32_t main() {
    fio
    int m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {

        cout <<lb(a,b[j])<< " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int n;
int lb(vi &a , int key) {
    int high = n-1;
    int low = 0;
    int mid;
    int ans = -1;
    while(high >= low) {
        mid = (high+low)/2;
        if(a[mid] <= key) {
            ans = max(mid,ans);
            low = mid + 1;

        }
        else if(a[mid] > key) {
            high = mid - 1;
        }
    }

    return ans + 1;
}
int32_t main() {
    fio
    int m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {

        cout <<lb(a,b[j])<< " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};

bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
int32_t main() {
    fio
    int n,m;
    cin >> n >> m;
    vi a(n),b(m);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    sort(all(a));

    for (int j = 0; j < m; ++j) {
        int x = lower_bound(all(a),b[j]) - a.begin();
        cout << x << " ";
    }

    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}


#include <iostream>
#include <algorithm>
using namespace std;
int n,m,a[200005];

int bin(int val){
	int l = 0,r = n-1,mid,best = n;
	while(l <= r){
		mid = (l+r)/2;
		if(val < a[mid]){
			best = mid;
			r = mid - 1;
		}
		else l = mid + 1;
	}
	return best;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << bin(b) << " ";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;
vector<int> a;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << upper_bound(a.begin(),a.end(),b)-a.begin() << " ";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	scanf("%d%d",&n,&m);
	vector<int> a;
	for(int i = 0;i < n;i++){
		scanf("%d",&val);
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		scanf("%d",&b);
		printf("%d ",upper_bound(a.begin(),a.end(),b)-a.begin());
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m;

int bin(int toFindBigger, int a[]){
	int left = 0,right = n - 1,Best = 0;
	while(left <= right){
		int mid = (right + left) / 2;
		if(a[mid] > toFindBigger){
			Best = mid;
			right = mid - 1;
		}else{
			left = mid + 1;
		}
	}
	return Best;
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	scanf("%d%d",&n,&m);
	int a[200000];
	for(int i = 0;i < n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < m;i++){
		int b;
		scanf("%d",&b);
		printf("%d",*lower_bound(a,a+n,b));
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;
vector<int> a;
int main() {
	scanf("%d%d",&n,&m);
	for(int i = 0;i < n;i++){
		scanf("%d",&val);
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		scanf("%d",&b);
		printf("%d ",upper_bound(a.begin(),a.end(),b)-a.begin());
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	vector<int> a;
	for(int i = 0;i < n;i++){
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << upper_bound(a.begin(),a.end(),b)-a.begin() << " ";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	vector<int> a;
	for(int i = 0;i < n;i++){
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << upper_bound(a.begin(),a.end(),b)-a.begin() << " ";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	vector<int> a;
	for(int i = 0;i < n;i++){
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << upper_bound(a.begin(),a.end(),b)-a.begin()) << " ";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,val;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.in","r",stdin);
	#endif
	scanf("%d%d",&n,&m);
	vector<int> a;
	for(int i = 0;i < n;i++){
		scanf("%d",&val);
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		scanf("%d",&b);
		printf("%d ",lower_bound(a.begin(),a.end(),b)-a.begin());
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r) {
  if (l >= r) return r;
  else if (r < 0) return 0;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1);
    else return binarySearch(x, a, mid + 1, r);
  }
}

int main() {
  #ifdef _DEBUG
	freopen("input.txt", "r", stdin);
  #endif

  ll n, m;
  cin >> n >> m;
  ll a[n], b[m];
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  ll ans[m];
  for (ll i = 0; i < m; i++) ans[i] = binarySearch(b[i], a, 0, n) + 1;
  for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r) {
  if (l > r) return r;
  else if (r < 0) return 0;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1);
    else return binarySearch(x, a, mid + 1, r);
  }
}

int main() {
  #ifdef _DEBUG
	freopen("input.txt", "r", stdin);
  #endif

  ll n, m;
  cin >> n >> m;
  ll a[n], b[m];
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  ll ans[m];
  for (ll i = 0; i < m; i++) ans[i] = binarySearch(b[i], a, 0, n) + 1;
  for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r, ll n) {
  if (l > r) return r;
  else if (r < 0) return 0;
  else if (l >= n) return n - 1;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1, n);
    else return binarySearch(x, a, mid + 1, r, n);
  }
}

int main() {
  #ifdef _DEBUG
	freopen("input.txt", "r", stdin);
  #endif

  ll n, m;
  cin >> n >> m;
  ll a[n], b[m];
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  ll ans[m];
  for (ll i = 0; i < m; i++) ans[i] = binarySearch(b[i], a, 0, n, n) + 1;
  for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

// ll binarySearch(ll x, ll a[], ll l, ll r, ll n) {
//   if (l > r) return r;
//   else if (r < 0) return 0;
//   else if (l >= n) return n - 1;
//   ll mid = (l + r) / 2;
//   if (a[mid] == x) {
//     while (a[mid + 1] == x) mid++;
//     return mid;
//   }
//   else {
//     if (a[mid] > x) return binarySearch(x, a, l, mid - 1, n);
//     else return binarySearch(x, a, mid + 1, r, n);
//   }
// }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  ll n, m;
  cin >> n >> m;
  ll a[n], b;
  for (ll i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  // ll ans[m];
  for (ll i = 0; i < m; i++) {
    cin >> b;
    cout << upper_bound(a, a + n, b) - a << " ";
    // cout << binarySearch(b, a, 0, n, n) + 1 << " ";
  }
  // for (ll i = 0; i < m; i++) cin >> b[i];
  // for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r, ll n) {
  if (l > r) return r;
  else if (r < 0) return 0;
  else if (l >= n) return n - 1;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1, n);
    else return binarySearch(x, a, mid + 1, r, n);
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  ll n, m;
  cin >> n >> m;
  ll a[n], b;
  for (ll i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  // ll ans[m];
  for (ll i = 0; i < m; i++) {
    cin >> b;
    cout << binarySearch(b, a, 0, n, n) + 1 << " ";
  }
  // for (ll i = 0; i < m; i++) cin >> b[i];
  // for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r, ll n) {
  if (l > r) return r;
  else if (r < 0) return 0;
  else if (l >= n) return n - 1;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1, n);
    else return binarySearch(x, a, mid + 1, r, n);
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  ll n, m;
  cin >> n >> m;
  ll a[n], b[m];
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  ll ans[m];
  for (ll i = 0; i < m; i++) ans[i] = binarySearch(b[i], a, 0, n, n) + 1;
  for (ll i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll binarySearch(ll x, ll a[], ll l, ll r, ll n) {
  if (l > r) return r;
  else if (r < 0) return 0;
  else if (l >= n) return n - 1;
  ll mid = (l + r) / 2;
  if (a[mid] == x) {
    while (a[mid + 1] == x) mid++;
    return mid;
  }
  else {
    if (a[mid] > x) return binarySearch(x, a, l, mid - 1, n);
    else return binarySearch(x, a, mid + 1, r, n);
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  ll n, m;
  cin >> n >> m;
  ll a[n], b[m];
  for (ll i = 0; i < n; i++) scanf( "%lld", &a[i]);
  for (ll i = 0; i < m; i++) scanf( "%lld", &b[i]);
  sort(a, a + n);
  ll ans[m];
  for (ll i = 0; i < m; i++) ans[i] = binarySearch(b[i], a, 0, n, n) + 1;
  for (ll i = 0; i < m; i++) printf("%lld ", ans[i]);
  return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            if(a[m]>x)
            {
            return -1;
            }
            else
            {
            return m;
            }
        }
        else if((h-l)==1)
        {
            if(a[h]==x)
            {
            return h;
            }
            else if(a[l]==x)
            {
                return l;
            }
            else if(a[h]>x&&a[l]<x)
            {
            return l;
            }
            else if(a[h]<x&&a[l]>x)
            {
            return h;
            }
            else
            {
            return -1;
            }
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            if(a[m]>x)
            {
            return -1;
            }
            else
            {
            return m;
            }
        }
        else if((h-l)==1)
        {
            if(a[h]>x&&a[l]<x)
            {
            return l;
            }
            else if(a[h]<x&&a[l]>x)
            {
            return h;
            }
            else
            {
            return -1;
            }
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            if(a[m]>x)
            {
            return -1;
            }
            else
            {
            return m;
            }
        }
        else if((h-l)==1)
        {
            if(a[h]==x)
            {
            return h;
            }
            else if(a[l]==x)
            {
                return l;
            }
            else if(a[h]>x)//&&a[l]<x)
            {
            return l;
            }
            else //if(a[h]<x&&a[l]>x)
            {
            return h;
            }
           /* else
            {
            return -1;
            }*/
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=-1;
    h=n;
    while((l+1)<h)
    {
        m=((l+h)/2);
        if(a[m]<=x)
        {
            l=m;
        }
        else if(a[m]>x)
        {
            h=m;
        }
    }
    return l;
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            if(a[m]>x)
            {
            return -1;
            }
            else
            {
            return m;
            }
        }
        else if((h-l)==1)
        {
            if(a[h]==x)
            {
            return h;
            }
            else if(a[l]==x)
            {
                return l;
            }
            else if(a[h]>x)//&&a[l]<x)
            {
            return l;
            }
            else if(a[h]>x&&a[l]>x)
            {
            return -1;
            }
            else //if(a[h]<x&&a[l]>x)
            {
            return h;
            }
           /* else
            {
            return -1;
            }*/
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            if(a[m]>x)
            {
            return -1;
            }
            else
            {
            return m;
            }
        }
        else if((h-l)==1)
        {
            if(a[h]==x)
            {
            return h;
            }
            else if(a[l]==x)
            {
                return l;
            }
            else if(a[h]>x&&a[l]>x)
            {
            return -1;
            }
            else if(a[h]>x)//&&a[l]<x)
            {
            return l;
            }
            else //if(a[h]<x&&a[l]>x)
            {
            return h;
            }
           /* else
            {
            return -1;
            }*/
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;
ll point(ll n,ll a[200009],ll x)
{
    ll h,l,m;
    l=0;
    h=(n-1);
    while(l<=h)
    {
        m=((l+h)/2);
        if(a[m]==x)
        {
        return m;
        }
        else if(h==l)
        {
            return m;
        }
        else if((h-l)==1)
        {
            if(a[h]>x)
            {
            return l;
            }
            else
            {
            return h;
            }
        }
        else if(a[m]<x)
        {
            //l=m+1;
            l=m;
        }
        else if(a[m]>x)
        {
            //h=m-1;
            h=m;
        }
    }
}
int main()
{
    ll n,m,a[200009],b[200009],i,j,c;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(j=0;j<m;j++)
    {
        scanf("%lld",&b[j]);
    }
    sort(a,a+n);
    for(j=0;j<m;j++)
    {
        c=point(n,a,b[j])+1;
        printf("%lld ",c);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[200005] = {};
int B[200005] = {};
 int bindextree1[10000005] = {};
int bindextree2[100000005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree2[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree2[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    int neg = 0;
    for(int i = 1; i <= n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            neg++;
            builtree2(A[i] * -1, Min * -1);
        }
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            cout << neg + findvalue(B[i]) << " ";
        }
        else
        {
            int first = findvalue2((B[i]*-1)-1);
            first = neg-first;
            cout << first << " ";
        }
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
unsigned int bindextree1[100000005] = {};
//unsigned int bindextree2[100005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    sort(A, A+n, greater<int>());
    int neg = 0;
    int st = n;
    for(int i = 0; i < n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            st = i;
            break;
        }
    }
    neg = n-st;
    int store[m+5] = {};
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            store[i] = neg + findvalue(B[i]);
        }
    }
    memset(bindextree1, 0, sizeof(bindextree1));
    for(int i = st; i < n; i++)
    {
        if(neg > 0)
        {
            builtree2(A[i]*-1, Min*-1);
        }
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] < 0)
        {
            int first = findvalue2((B[i]*-1)-1);
            store[i] = first = neg-first;
        }
    }
    for(int i = 1; i <= m; i++)
    {
        cout << store[i] << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int>vv;
    for(int i = 1; i <= n; i++)
    {
        int tem;
        cin >> tem;
        vv.push_back(tem);
    }
    sort(vv.begin(), vv.end());
    for(int i = 1; i <= m; i++)
    {
        int tem;
        cin >> tem;
        cout << upper_bound(vv.begin(), vv.end(), tem) - vv.begin() << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
int bindextree[100005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    for(int i = 1; i <= n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    for(int i = 1; i <= n; i++)
    {
        builtree(A[i], Max);
    }
    for(int i = 1; i <= m; i++)
    {
        cout << findvalue(B[i]) << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
unsigned int bindextree1[100005] = {};
unsigned int bindextree2[100005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree2[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree2[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    int neg = 0;
    for(int i = 1; i <= n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            neg++;
            builtree2(A[i] * -1, Min * -1);
        }
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            cout << neg + findvalue(B[i]) << " ";
        }
        else
        {
            int first = findvalue2((B[i]*-1)-1);
            first = neg-first;
            cout << first << " ";
        }
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
unsigned int bindextree1[100000005] = {};
//unsigned int bindextree2[100005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    sort(A, A+n, greater<int>());
    int neg = 0;
    int st = n-1;
    for(int i = 0; i < n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            st = i;
            break;
        }
    }
    neg = n-st;
    int store[m+5] = {};
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            store[i] = neg + findvalue(B[i]);
        }
    }
    memset(bindextree1, 0, sizeof(bindextree1));
    for(int i = st; i < n; i++)
    {
        builtree2(A[i]*-1, Min*-1);
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] < 0)
        {
            int first = findvalue2((B[i]*-1)-1);
            store[i] = first = neg-first;
        }
    }
    for(int i = 1; i <= m; i++)
    {
        cout << store[i] << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
unsigned int bindextree1[100000005] = {};
unsigned int bindextree2[100000005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree2[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree2[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    int neg = 0;
    for(int i = 1; i <= n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            neg++;
            builtree2(A[i] * -1, Min * -1);
        }
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            cout << neg + findvalue(B[i]) << " ";
        }
        else
        {
            int first = findvalue2((B[i]*-1)-1);
            first = neg-first;
            cout << first << " ";
        }
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[200005] = {};
int B[200005] = {};
unsigned int bindextree1[100000005] = {};
//unsigned int bindextree2[100005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    sort(A, A+n, greater<int>());
    int neg = 0;
    int st = n-1;
    for(int i = 0; i < n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            st = i;
            break;
        }
    }
    neg = n-st;
    int store[m+5] = {};
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            store[i] = neg + findvalue(B[i]);
        }
    }
    memset(bindextree1, 0, sizeof(bindextree1));
    for(int i = st; i < n; i++)
    {
        builtree2(A[i]*-1, Min*-1);
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] < 0)
        {
            int first = findvalue2((B[i]*-1)-1);
            store[i] = first = neg-first;
        }
    }
    for(int i = 1; i <= m; i++)
    {
        cout << store[i] << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int A[100005] = {};
int B[100005] = {};
unsigned int bindextree1[400000005] = {};
unsigned int bindextree2[400000005] = {};
void builtree(int value, int n)
{
    while(value <= n)
    {
        bindextree1[value]++;
        value += value & (-value);
    }
}
int findvalue(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree1[index];
        index -= index & (-index);
    }
    return Sum;
}
void builtree2(int value, int n)
{
    while(value <= n)
    {
        bindextree2[value]++;
        value += value & (-value);
    }
}
int findvalue2(int index)
{
    int Sum = 0;
    while(index > 0)
    {
        Sum += bindextree2[index];
        index -= index & (-index);
    }
    return Sum;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int Max = n;
    int Min = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min, A[i]);
    }
    for(int j = 1; j <= m; j++)
    {
        cin >> B[j];
    }
    int neg = 0;
    for(int i = 1; i <= n; i++)
    {
        if(A[i] >= 0)
        {
            builtree(A[i], Max);
        }
        else
        {
            neg++;
            builtree2(A[i] * -1, Min * -1);
        }
    }
    for(int i = 1; i <= m; i++)
    {
        if(B[i] >= 0)
        {
            cout << neg + findvalue(B[i]) << " ";
        }
        else
        {
            int first = findvalue2((B[i]*-1)-1);
            first = neg-first;
            cout << first << " ";
        }
    }
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n,m,x;
int ans[202020];
int a[202020];
pair<int,int> b[202020];

int main(){
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d ",a+i);
	for (int i=1;i<=m;i++) {
		scanf("%d ",&x);
		b[i].first = x;
		b[i].second = i;
	}

	sort(a+1,a+n+1);
	sort(b+1,b+m+1);

	a[n+1] = 2e9;

	int i = 1;
	int j = 1;

	while (j <= m){
		while (i<=n&&a[i]<=b[j].first) i++;
		ans[b[j].second] = i-1;
		j++;
	}

	for (int i=1;i<=m;i++) printf("%d ",a[i]);

}


#include <bits/stdc++.h>
using namespace std;

int n,m;
int a[202020];
int b[202020];

int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=m;i++) cin>>b[i];

	// O(N^2)
	for (int i=1;i<=m;i++){
		int ans = 0;
		for (int j=1;j<=n;j++){
			if (a[j] <= b[i]) ans++;
		}
		cout<<ans<<" ";
	}

}


#include <bits/stdc++.h>
using namespace std;

int n,m;
int ans[202020];
int a[202020];
pair<int,int> b[202020];

int main(){
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d ",a+i);
	for (int i=1;i<=m;i++) {
		scanf("%d ",(b+i).second);
		b[i].second = i;
	}

	sort(a+1,a+n+1);
	sort(b+1,b+m+1);

	a[n+1] = 3e9;

	int i = 1;
	int j = 1;

	while (j <= m){
		while (i<=n&&a[i]<=b[j].first) i++;
		ans[b[j].second] = i-1;
		j++;
	}

	for (int i=1;i<=m;i++) printf("%d ",a[i]);

}


#include <bits/stdc++.h>
using namespace std;

int n,m;
int ans[202020];
long long a[202020];
pair<long long,int> b[202020];

int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=m;i++) {
		cin>>b[i].first;
		b[i].second = i;
	}

	sort(a+1,a+n+1);
	sort(b+1,b+m+1);

	a[n+1] = 1e16;

	int i = 1;
	int j = 1;

	while (j <= m){
		while ( i <= n && a[i] <= b[j] ) i++;
		ans[b[j].second] = i-1;
		j++;
	}

	for (int i=1;i<=m;i++) cout<<ans[i]<<" ";

}


#include <bits/stdc++.h>
using namespace std;

int n,m,x;
int ans[202020];
int a[202020];
pair<int,int> b[202020];

int main(){
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d ",a+i);
	for (int i=1;i<=m;i++) {
		scanf("%d ",&x);
		b[i].first = x;
		b[i].second = i;
	}

	sort(a+1,a+n+1);
	sort(b+1,b+m+1);

	a[n+1] = 2e9;

	int i = 1;
	int j = 1;

	while (j <= m){
		while (i<=n&&a[i]<=b[j].first) i++;
		ans[b[j].second] = i-1;
		j++;
	}

	for (int i=1;i<=m;i++) printf("%d ",ans[i]);

}


#include <bits/stdc++.h>
using namespace std;

int n,m,x;
vector<long long> a;
long long b[202020];

int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) {
		cin>>x;
		a.push_back(x);
	}
	for (int i=1;i<=m;i++)cin>>b[i];
	sort(a.begin(),a.end());
	for (int i=1;i<=m;i++){
		int ans = upper_bound(a.begin(),a.end(),b[i]) - a.begin();
		cout<<ans<<" ";
	}
}


#include <bits/stdc++.h>
using namespace std;

int n,m;
int ans[202020];
long long a[202020];
pair<long long,int> b[202020];

int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=m;i++) {
		cin>>b[i].first;
		b[i].second = i;
	}

	sort(a+1,a+n+1);
	sort(b+1,b+m+1);

	a[n+1] = 1e16;

	int i = 1;
	int j = 1;

	while (j <= m){
		while (i<=n&&a[i]<=b[j].first) i++;
		ans[b[j].second] = i-1;
		j++;
	}

	for (int i=1;i<=m;i++) cout<<ans[i]<<" ";

}


#include <bits/stdc++.h>
using namespace std;

int n,m,x;
vector<long long> a;
long long b[202020];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin>>n>>m;
	for (int i=1;i<=n;i++) {
		cin>>x;
		a.push_back(x);
	}
	for (int i=1;i<=m;i++)cin>>b[i];
	sort(a.begin(),a.end());
	for (int i=1;i<=m;i++){
		int ans = upper_bound(a.begin(),a.end(),b[i]) - a.begin();
		cout<<ans<<" ";
	}
}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n-1,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    low = 0;
    high = len;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    while(mid>=0)
    {
        if(a[mid]>x)
        {
            mid--;
           // cout << " " << mid << endl;
        }
        else
            return mid+1;

    }
    return mid;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<m; ++i)
        cin >> b[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
    {
        count = 0;
        for(int j=0; j<n; ++j)
        {
            if(b[i]>=a[j])
            {
                count++;
            }
            else
                goto label;

        }
        label:
        cout << count << " ";
    }
}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    if(a[len-1]<=x)
        return len;

    else if(a[0]>x)
        return 0;

    low = 0;
    high = len-1;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    if(a[mid-1]<=x)
        return mid;

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    while(mid>=0)
    {
        if(a[mid]>x)
        {
            mid--;
           // cout << " " << mid << endl;
        }
        else
            return mid+1;

    }
    return mid;

}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    low = 0;
    high = len-1;

    label:

    if(a[len-1]<=x)
        return len;

    else if(a[0]>x)
        return 0;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    if(a[mid-1]<=x)
        return mid;

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    if(a[mid]>x)
    {
        high = mid;
        goto label;
           // cout << " " << mid << endl;
    }

}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    if(a[len]<=x)
        return len;

    else if(a[0]>x)
        return 0;

    low = 0;
    high = len-1;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    while(mid>=0)
    {
        if(a[mid]>x)
        {
            mid--;
           // cout << " " << mid << endl;
        }
        else
            return mid+1;

    }
    return mid;

}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<m; ++i)
        cin >> b[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n-1,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    low = 0;
    high = len;
    mid = (low + high) / 2;
    while(a[mid] <= x)
    {
        low = mid+1;
        mid = (low + high)/2;
    }

    //cout << "Mid: " << mid <<endl;

    while(mid--)
    {
        if(a[mid]<=x)
            return mid+1;
    }

}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n-1,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    low = 0;
    high = len;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    while(mid>=0)
    {
        if(a[mid]>x)
        {
            mid--;
           // cout << " " << mid << endl;
        }
        else
            return mid+1;

    }
    return mid+1;

}


#include<bits/stdc++.h>
using namespace std;

int bisearch(long long *a, int len, long long x);

int main()
{
   int n,m,count;

   cin >> n >> m;

   long long a[n], b[m];

   for(int i=0; i<n; ++i)
        cin >> a[i];

    sort(a,a+n);

    for(int i=0; i<m; ++i)
        cin >> b[i];

    for(int i=0; i<m; ++i)
    {
        count = bisearch(a,n,b[i]);

        cout << count << " ";
    }
}

int bisearch(long long *a, int len, long long x)
{
    int low,mid,high;

    if(a[len-1]<=x)
        return len;

    else if(a[0]>x)
        return 0;

    low = 0;
    high = len-1;

    while(low <= high)
    {
        mid = (low + high)/2;
        if(a[mid]<=x)
            low = mid+1;
        else
            break;

    }

    //cout << "Mid: " << mid << " x: " << x << " a: "<< a[mid] << endl;

    while(mid>=0)
    {
        if(a[mid]>x)
        {
            mid--;
           // cout << " " << mid << endl;
        }
        else
            return mid+1;

    }
    return mid;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
       ios_base::sync_with_stdio(0);
        cin.tie(0);
     ll n,m;
    int i,j,cnt=0;
    cin>>n>>m;
    ll  a[n+1];
    ll b[n+1];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
        for(j=0;j<m;j++){
           cin>>b[j];
    }
    for(i=0;i<m;i++){
            cnt=0;
        for(j=0;j<n;j++){
            if(a[j]<=b[i]) cnt++;
        }
          cout<<cnt<<" ";
    }
    cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define urs(r...)               typename decay<decltype(r)>::type
#define FOR(i,a,b)              for(urs(b) i=a;i<=b;i++)
#define ROF(i,a,b)              for(urs(b) i=a;i>=b;i--)
#define REP(i,b)                for(urs(b) i=0;i<b;i++)
#define int long long int
#define ff first
#define ss second
main()
{
	int n,i,j,k,m;
	cin>>n>>m;
	int a[n+3];
	int b[m+3];
	for(i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	for(i=0;i<m;i++) cin>>b[i];
	for(i=0;i<m;i++)
	{
		int lo=0;
		int hi=n-1;
		int mid;
		int ans;
		while(lo<=hi)
		{
			mid=(lo+hi)>>1;
			if(b[i]>=a[mid])
			{
		         lo=mid+1;
		         ans=mid+1;
			}
			else
			{
	          hi=mid-1;
			}
		}
		cout<<ans<<" ";
	}
	cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
     ll n,m;
    ll i,j,cnt=0;
    cin>>n>>m;
    ll  a[n+1];
    ll b[m+1];
    memset(a,0,sizeof(a));
     memset(b,0,sizeof(b));
    for(i=0;i<n;i++){
        cin>>a[i];
    }
        for(j=0;j<m;j++){
           cin>>b[j];
    }
    for(i=0;i<m;i++){
            cnt=0;
        for(j=0;j<n;j++){
            if(a[j]<=b[i]) cnt++;
        }
          cout<<cnt<<" ";
    }
    cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int n,x,sum;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x);
        if(x==0||n==1)
            sum++;
    }
    if(sum==1)printf("YES");
    else printf("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		ans+=(!x);
	}
	if(ans==1) printf("YES\n");
	else printf("NO\n");
}


// luogu-judger-enable-o2
#include<bits/stdc++.h>
int n,ans,a[1001];
main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++) {
		scanf("%d",&a[i]);
		ans+=a[i];
	}
	if(ans==n||ans-n==1) printf("YES");
	else printf("NO");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool a=0;
int n,i,x;
int main()
{
   cin>>n;
   cin>>x;
   if(!x)a++;
   if(n==1)if(!a)
   {
   	cout<<"YES";
   	return 0;
   	   }
   	   else{
   	   	 cout<<"NO";return 0;
   	   }
   for(i=2;i<=n;i++)
   {
   	cin>>x;
   if(!x)
   if(a){
   	cout<<"NO";return 0;
   }
   else a++;
   }

   cout<<"YES";
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
int t[2],a[1001],n;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
	{
        cin>>a[i];
        t[a[i]]++;
    }
    cout<<(t[0]==1?"YES\n":"NO\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[10010];
int main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]==0) sum++;
	}
	if(sum>=2) cout<<"是"<<endl;
	else cout<<"不"<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,y=0,a[10000],i;
	cin>>n;
    for(i=1;i<=n;++i){
    	cin>>a[i];
    	if(a[i]==0)y++;
    }
    if(y==1&&n!=1)cout<<"YES";
    else cout<<"NO";
}


#include<bits/stdc++.h>

using namespace std;

int a[2000], ans;

int main ()
{
	int n;
	scanf("%d", &n);
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &a[i]);
		if(a[i] == 0)
		{
			ans++;
		}
	}
	if(n == 1 && ans == 1)
	{
		printf("YES");
	}
	else
	if(ans == 1)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
}


#include<bits/stdc++.h>

using namespace std;

int a[2000], ans;

int main ()
{
	int n;
	scanf("%d", &n);
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &a[i]);
		ans+=a[i];
	}
	if(n == 1 && n-ans == 0)
	{
		printf("YES");
	}
	else
	if(n-ans == 1)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
}


#include<bits/stdc++.h>

using namespace std;

int ans;

int main ()
{
	int n;
	scanf("%d", &n);
	if(n == 1)
	{
		scanf("%d", &ans);
		if(ans == 0)
			puts("YES");
		else
			puts("NO");

		return 0;
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &ans);
		if(ans == 0)
			++cnt;
	}
	if(cnt == 1)
		puts("YES");
	else
		puts("NO");
}


#include<bits/stdc++.h>

using namespace std;

int a[2000], ans;

int main ()
{
	int n;
	scanf("%d", &n);
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &a[i]);
		if(a[i] == 0)
		{
			ans++;
		}
	}
	if(ans == 1)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
}


#include<bits/stdc++.h>

using namespace std;

int ans;

int main ()
{
	int n;
	scanf("%d", &n);
	if(n == 1)
	{
		scanf("%d", &ans);
		if(ans == 1)
			puts("YES");
		else
			puts("NO");
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &ans);
		if(ans == 0)
			++cnt;
	}
	if(cnt == 1)
		puts("YES");
	else
		puts("NO");
}


#include<bits/stdc++.h>

using namespace std;

int a[2000], ans;

int main ()
{
	int n;
	scanf("%d", &n);
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &a[i]);
		if(a[i] == 0)
		{
			ans++;
		}
		if(ans > 1)
		{
			printf("NO");
			return 0;
		}
	}
	if(n == 1 && ans == 1)
	{
		printf("YES");
	}
	else
	if(ans == 1)
	{
		printf("YES");
	}
}


#include<bits/stdc++.h>

using namespace std;

int ans;

int main ()
{
	int n;
	scanf("%d", &n);
	if(n == 1)
	{
		scanf("%d", &ans);
		if(ans == 1)
			puts("YES");
		else
			puts("NO");

		return 0;
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &ans);
		if(ans == 0)
			++cnt;
	}
	if(cnt == 1)
		puts("YES");
	else
		puts("NO");
}


#include<bits/stdc++.h>

using namespace std;

int ans;

int main ()
{
	int n;
	scanf("%d", &n);
	if(n == 1)
	{
		scanf("%d", &ans);
		if(ans == 1)
			printf("YES");
		else
			printf("NO");
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &ans);
		if(ans == 0)
			++cnt;
	}
	if(cnt == 1)
		printf("YES");
	else
		printf("NO");
}


#include<bits/stdc++.h>

using namespace std;

int a[2000], ans;

int main ()
{
	int n;
	scanf("%d", &n);
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &a[i]);
		if(a[i] == 0)
		{
			ans++;
		}
		if(ans > 1)
		{
			printf("NO");
			return 0;
		}
	}
	if(n == 1 && ans == 1)
	{
		printf("YES");
	}
	else
	if(ans == 1)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
}


#include<bits/stdc++.h>

using namespace std;

int ans;

int main ()
{
	int n;
	if(n==1)
	{
		int t;
		cin >> t;
		if(t!=0)
		cout << "YES";
		else
		cout << "NO";
		return 0;
	}
	scanf("%d", &n);
	if(n == 1)
	{
		scanf("%d", &ans);
		if(ans == 1)
			puts("YES");
		else
			puts("NO");
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++i)
	{
		scanf("%d", &ans);
		if(ans == 0)
			++cnt;
	}
	if(cnt == 1)
		puts("YES");
	else
		puts("NO");
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }
    if(n == 1){
        if(ara[0] == 1)
        printf("YES\n");
    else
        printf("NO\n");
    }
if(n > 1){
    if(sum == n - 1 && ara[0] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum == n - 1 && ara[n - 2] == 0){
        printf("YES\n");
    }
    else if(n == 1 && ara[0] == 1)
        printf("YES\n");
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0;

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        sum += j;
    }

    if((sum == n - 1 && j == 1) || sum == n){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, c = 0;

    cin >> n;

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        if(j == 0)
            c++;
    }
    if(n == 1){
        if(j)
            printf("YES\n");
        else
            printf("NO\n");
    }
    else{
        if(c == 1)
            printf("YES\n");
        else
            printf("NO\n");
    }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0;

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        sum += j;
    }

    if(sum >= n - 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum == n - 1 && ara[0] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, c = 0;

    cin >> n;

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        if(j == 0)
            c++;
    }
    if(c > 1 || j == 0)
        printf("NO\n");
    else
        printf("YES\n");

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }
        if(n == 1 && ara[0] == 1)
            printf("YES\n");
   else if(sum == n - 1 && ara[0] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, c = 0;

    cin >> n;

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        if(j == 0)
            c++;
    }
    if(n == 1){
        if(c)
            printf("YES\n");
        else
            printf("NO\n");
    }
    else{
        if(c == 1)
            printf("YES\n");
        else
            printf("NO\n");
    }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0;

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        sum += j;
    }

    if(sum >= n - 1 && j == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum == n - 1 && ara[n - 1] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum >= n - 1 && ara[0] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum == n - 1 && ara[0] == 1){
        printf("YES\n");
    }
    else if(n == 1 && ara[0] == 1)
        printf("YES\n");
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }
    if(n == 1){
        if(ara[0] == 1)
        printf("YES\n");
    else
        printf("NO\n");
    }
if(n > 1){
    if(sum == n - 1 && ara[n - 2] == 0){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0;

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &j);
        sum += j;
    }

    if((sum == n - 1 && j == 0) || sum == n){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i, j, n, sum = 0, ara[1005];

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &ara[i]);
        sum += ara[i];
    }

    if(sum >= n - 1 && ara[n - 1] == 1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
while(n--){
cin>>k;
if(k==0)
t++;

}
if(n!=1){
if (t<2) cout<<"YES\n";
else cout<<"NO\n";
}else{
	if(k==1)
    cout<<"YES\n";
    else cout<<"NO\n";
}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
while(n--){
cin>>k;
if(k==0)
t++;

}
if(n>1){
if (t==1) cout<<"YES\n";
else cout<<"NO\n";
}else{
	if(k==1)
    cout<<"YES\n";
    else cout<<"NO\n";
}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0;
cin>>n;
while(n--){
cin>>k;
if(k==0)
t++;
}
if (t<=1) cout<<"YES\n";
else cout<<"NO\n";
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
while(n--){
cin>>k;
if(k==0)
t++;
else
y++;
}
if (t<y) cout<<"YES\n";
else cout<<"NO\n";
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
y=n;
while(y--){
cin>>k;
if(k==1)
t++;

}
//cout<<t<<n;
if(n==1 && k==1) cout<<"YES\n";
else if(n>1 && t == n-1)cout<<"YES\n";
else cout<<"NO\n";

	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
while(n--){
cin>>k;
if(k==1)
t++;

}
if(n!=1){
if (t>1) cout<<"YES\n";
else cout<<"NO\n";
}else{
cout<<"YES\n";
}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0;
cin>>n;
while(n--){
cin>>k;
if(k==0)
t++;
}
if (t>1) cout<<"NO\n";
else cout<<"YES\n";
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,k,t=0,y=0;
cin>>n;
while(n--){
cin>>k;
if(k==1)
t++;

}
if (t>1) cout<<"YES\n";
else cout<<"NO\n";
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			m += a;
		}
		if (m != n - 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		printf("YES\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			if (a == 0)
			{
				m++;
			}
		}
		if (m > 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else if (n == 2)
	{
		int b;
		scanf("%d %d", &a, &b);
		if (b == 0)printf("NO\n");
		else printf("YES\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			if (a == 0)
			{
				m++;
			}
		}
		if (m > 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			m += a;
		}
		if (m == n - 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			if (a == 0)
			{
				m++;
			}
		}
		if (m > 1 || a == 0)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			if (a == 0)
			{
				m++;
			}
		}
		if (m > 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int a[1002];
int main()
{
	int n;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a[0]);
		if (a[0])
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a[i]);
			if (a[i] == 0)
			{
				m++;
			}
		}
		if(m>1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n, a;
	scanf("%d", &n);
	if (n==1)
	{
		scanf("%d", &a);
		if (a==1)
		{
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &a);
			m += a;
		}
		if (m < n - 1)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,t;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) {
		cin >> v[0];
		if(v[0]==1) cout << "YES";
		else cout << "NO";
	}

	else {
		for (int i = 0; i < n; i++) {
			cin >> t;
			v.push_back(t);
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2) cout << "NO";
		else cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,t;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) {
		cin >> v[0];
		if(v[0]==1) cout << "YES";
		else cout << "NO";
	}

	else {
		for (int i = 0; i < n; i++) {
			cin >> t;
			v.push_back(t);
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2 || count == 0) cout << "NO";
		else cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) {
		cin >> v[0];
		if(v[0]==1) cout << "YES";
		else cout << "NO";
	}

	else {
		for (int i = 0; i <= n; i++) {
			cin >> v[i];
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2) cout << "NO";
		else cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,t;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) {
		cin >> t;
		if(t==1) cout << "YES";
		else cout << "NO";
	}

	else {
		for (int i = 0; i < n; i++) {
			cin >> t;
			v.push_back(t);
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2 || count == 0) cout << "NO";
		else cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) cout << "YES";

	for (int i = 0; i <= n; i++) {
		cin >> v[i];
	}

	for (int i = 0; i < v.size(); i++) {
		if (v[i] == 0) count++;
	}
	if (count >= 2) cout << "NO";
	else cout << "YES";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,t;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) {
		cin >> v[0];
		if(v[0]==1) cout << "YES";
		else cout << "NO";
	}

	else {
		for (int i = 0; i < n; i++) {
			cin >> t;
			v.push_back(t);
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2) cout << "NO";
		else if(count<2) cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n;
vector<int> v;

int main() {
	int count = 0;
	cin >> n;
	if (n == 1) cout << "YES";
	else {
		for (int i = 0; i <= n; i++) {
			cin >> v[i];
		}

		for (int i = 0; i < v.size(); i++) {
			if (v[i] == 0) count++;
		}
		if (count >= 2) cout << "NO";
		else cout << "YES";
	}
	return 0;
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (m==n)
	{
		cout<<"NO";
		return -1;
	}
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (n==1 && n==0)
	{
		cout<<"YES";
	}else
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (n==1 && n==1)
	{
		cout<<"YES";
	}else
	if (n==1 && n==0)
	{
		cout<<"NO";
	}else
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0;
	while(n--)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
	}
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (n==1 && n==0)
	{
		cout<<"NO";
	}else
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (n==1 && k==1)
	{
		cout<<"YES";
	}else
	if (n==1 && k==0)
	{
		cout<<"NO";
	}else
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
	setlocale(LC_ALL,"rus");
	int n;
	cin>>n;
	int k;
	int l=0,m=0;
	int i=0;
	while(n>i)
	{
		cin>>k;
		if (k==0)
		{
			l++;
		}
		else if (k==1)
		{
			m++;
		}
		i++;
	}
//	cout<<m<<" "<<i;
	if (n==1 && n==1)
	{
		cout<<"YES";
	}else
	if (m==n)
	{
		cout<<"NO";
	}else
	if (l>=2)
	{
		cout<<"NO";
	}else
	cout<<"YES";
	return 0;
	_getch();
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	int x, n, t = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x, t += x;
		cout << ((n == 1) ? ((t == 1) ? "YES" : "NO") : (t == n - 1) ? "YES" : "NO");
	}
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	int x, n, t = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x, t += x;
		cout << ((n == 1 ? )((t == 1) ? "YES" : "NO") : (t == n - 1) ? "YES" : "NO");
	}
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	int x, n, t = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x, t += x;
	}
	cout << ((n == 1) ? ((t == 1) ? "YES" : "NO") : (t == n - 1) ? "YES" : "NO");
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	if (v[0] == 1 && v[n-1] == 1) {
		cout << "YES";
	}
	else
		cout << "NO";
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	if ((v[0] == 1 && v[n - 1] == 1)||(v[1]==1&&v[n-2]==1)||(v[0]==1&&v[n-2]==1)||(v[1]==1&&v[n-1]==1) ){
		cout << "YES";
	}
	else
		cout << "NO";
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	if (v[0] == 1 || v[n-1] == 1) {
		cout << "YES";
	}
	else
		cout << "NO";
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	if (v[0] == 1 && v[n - 1] == 1) {
		cout << "YES";
	}
	else
		cout << "NO";
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n,tong=0;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		tong += v[i];
	}
	if (tong == n)
		cout << "NO";
	else {
		if ((v[0] == 1 && v[n - 1] == 1) || (v[1] == 1 && v[n - 2] == 1) || (v[0] == 1 && v[n - 2] == 1) || (v[1] == 1 && v[n - 1] == 1)) {
			cout << "YES";
		}
		else
			cout << "NO";
	}
	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
int main() {
	vector<int> v;
	int n,tong=0;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		tong += v[i];
	}
	if (n == 1 && v[0] == 1)
		cout << "YES";
	else if (n == 1 && v[0] == 0)
		cout << "NO";
	if (tong < n)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}