#include <bits/stdc++.h>
using namespace std;
int n, k, m[2005], t[2005], res;
map<int, int> mp, mark;
vector<int> re;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &m[i]);
    m[i] += m[i - 1];
    mp[m[i]] = 1;
  }
  for (int i = 1; i <= k; i++) scanf("%d", &t[i]);
  sort(t + 1, t + k + 1);
  for (int i = 1; i <= n; i++) {
    bool kt = true;
    int temp = t[1] - m[i];
    for (int j = 1; j <= k; j++) {
      if (mp[t[j] - temp] != 1) {
        kt = false;
        break;
      }
    }
    if ((kt) && (mark[temp] == 0)) {
      res++;
      mark[temp] = 1;
    }
  }
  printf("%d", res);
  return 0;
}
