#include <bits/stdc++.h>
using namespace std;
long long n, a[2002], b[2002], aa[2002], k, ans;
int main() {
  cin >> k >> n;
  for (int i = 0; i < k; i++) {
    cin >> a[i];
    if (i > 0)
      aa[i] = a[i] + aa[i - 1];
    else
      aa[i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(b, b + n);
  sort(aa, aa + k);
  if (n == 1) {
    ans = 1;
    for (int i = 0; i < k - 1; i++) {
      if (aa[i] != aa[i + 1]) {
        ans++;
      }
    }
    cout << ans;
    return 0;
  } else {
    long long i, j, jj, p;
    for (int l = 0; l < k - n + 1; l++) {
      i = 0, j = l, jj = j;
      long long anss = 1;
      bool fl = true;
      for (i = 0; i < n - 1; i++) {
        p = j;
        while (aa[p] - aa[j] < b[i + 1] - b[i] && p < k) p++;
        if (p >= k) {
          fl = false;
          break;
        }
        if (aa[p] - aa[j] == b[i + 1] - b[i]) {
          int dem = 1;
          while (aa[p + 1] == aa[p]) {
            p++;
          }
          j = p;
          ;
        } else {
          if ((aa[p] - aa[j] > b[i + 1] - b[i])) {
            fl = false;
            break;
          }
        }
      }
      if (fl) ans += anss;
    }
    cout << ans;
  }
}
