#include <bits/stdc++.h>
using namespace std;
int n, k, sum, x;
int arr[2005], brr[2005];
map<int, bool> ada, udah;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> k >> n;
  for (int i = 0; i < k; i++) {
    cin >> x;
    sum += x;
    arr[i] = sum;
    ada[sum] = true;
  }
  sort(arr, arr + k);
  for (int i = 0; i < n; i++) {
    cin >> brr[i];
  }
  sort(brr, brr + n);
  int ans = 0;
  for (int i = 0; i < k; i++) {
    int bil = 0;
    bool can = true;
    for (int j = 0; j < n; j++) {
      if (j == 0)
        bil = brr[j] - arr[i];
      else {
        if (!ada[brr[j] - bil]) {
          can = false;
          break;
        }
      }
    }
    if (can && !udah[bil]) {
      ans++;
      udah[bil] = true;
    }
  }
  cout << ans << '\n';
  return 0;
}
