#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, i, j, a[2500], b[2500], sum[3000];
  cin >> k >> n;
  set<int> s1, s2;
  for (i = 0; i < k; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    for (j = 0; j < k; j++) {
      if (i == 0 or s1.find(b[i] - sum[j]) != s1.end())
        s2.insert(b[i] - sum[j]);
    }
    s1 = s2;
    s2.clear();
  }
  cout << s1.size();
}
