#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n], sum[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sum[0] = arr[0];
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + arr[i];
  }
  set<int> q[k];
  long long arr1[k];
  for (int i = 0; i < k; i++) {
    cin >> arr1[i];
    for (int j = 0; j < n; j++) {
      q[i].insert(arr1[i] - sum[j]);
    }
  }
  int ans = 0;
  set<int>::iterator it;
  for (it = q[0].begin(); it != q[0].end(); it++) {
    bool flag = false;
    int t = *it;
    for (int j = 1; j < k; j++) {
      if (q[j].find(t) != q[j].end())
        continue;
      else {
        flag = true;
        break;
      }
    }
    if (!flag) ans++;
  }
  cout << ans;
}
