Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
697 B
11
Indexable
Never
#include<bits/stdc++.h>

using namespace std;

#define runtime() ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"

int main()
{

    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r",stdin);
        freopen("output.txt", "w",stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // just code it 

    // main code

    int n, m; cin >> n >> m;

    vector<int> v(n);

    for (auto &x: v) {cin >> x;}

    vector<int> b(m);

    for (auto &x: b)
    {
        cin >> x;

        set<int> s;

        for (int i = x - 1; i < n; i++)
        {
            s.insert(v[i]);
        }

        cout << s.size() << endl;
    }



    return 0;
}