#include <bits/stdc++.h>
using namespace std;
#define MAXN 600001
int n, m, k;
int a[MAXN], b[17], c[MAXN][17];
queue<pair<int, int>> que;
bool check(int x){
int cnt(0);
for (int i(1); i<=16; ++i){
if (c[x+m][i]-c[x][i] != b[i]) ++cnt;
}
return cnt <= k;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> k;
for (int i(1); i<=n; ++i){
cin >> a[i];
memcpy(c[i], c[i-1], sizeof(c[i]));
if (a[i]) ++c[i][a[i]];
}
for (int i(1); i<=16; ++i) cin >> b[i];
for (int i(1); i+m-1<=n; ++i){
if (check(i-1)) que.push(make_pair(i, i+m-1));
}
cout << que.size() << '\n';
while (!que.empty()){
cout << que.front().first << ' ' << que.front().second << '\n';
que.pop();
}
return 0;
}
思路就是前缀和