#include <bits/stdc++.h>
using namespace std;
int A[2005], B[2005];
int n, tol, k;
bool judge(int k) {
  int l = 1, r = tol;
  while (l <= r) {
    int m = l + (r - l) / 2;
    if (A[m] == k) {
      return true;
    }
    if (A[m] > k) {
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  return false;
}
bool cmp(int a, int b) { return a > b; }
int main() {
  scanf("%d%d", &k, &n);
  int num, sum = 0;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &num);
    sum += num;
    A[i] = sum;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &B[i]);
  }
  sort(A + 1, A + 1 + k);
  tol = 1;
  for (int i = 2; i <= k; i++) {
    if (A[i] != A[i - 1]) {
      A[++tol] = A[i];
    }
  }
  sort(B + 1, B + 1 + n);
  int ans = 0;
  for (int i = 1; i <= tol - n + 1; i++) {
    num = B[1] - A[i];
    int flag = 1;
    for (int j = 2; j <= n; j++) {
      if (!judge(B[j] - num)) {
        flag = 0;
        break;
      }
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}
