#include <bits/stdc++.h>
std::map<int, int> mp;
int main(void) {
  int k, n, ans = 0, tmp, lst = 0, t[2010];
  scanf("%d%d", &k, &n);
  for (int i = 0; i < k; i++) {
    scanf("%d", &tmp);
    mp[lst = tmp + lst] = 1;
  }
  for (int i = 0; i < n; i++) scanf("%d", &t[i]);
  for (auto x : mp) {
    int flag = 1;
    for (int j = 0; j < n; j++)
      if (!mp[t[j] - t[0] + x.first]) {
        flag = 0;
        break;
      }
    if (flag) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
