#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) { return a + b - max(a, b); }
long long mod(long long a, long long b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long ctr1;
bool possible(long long num, vector<long long> sum, long long b[],
              long long n) {
  for (long long i = 0; i < n; i++) {
    if (binary_search(sum.begin(), sum.end(), b[i] - num) == false)
      return false;
  }
  ctr1++;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  cin >> k >> n;
  vector<long long> sum;
  long long arr[k + 5];
  for (long long i = 0; i < k; i++) {
    cin >> arr[i];
    if (i == 0)
      sum.push_back(arr[0]);
    else
      sum.push_back(sum[i - 1] + arr[i]);
  }
  long long b[n + 5];
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(b, b + n);
  long long ctr = 0;
  sort(sum.begin(), sum.end());
  set<long long> s1;
  for (long long i = 0; i < k; i++) {
    if (possible(b[0] - sum[i], sum, b, n)) s1.insert(b[0] - sum[i]);
  }
  cout << s1.size();
}
