#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, i, j, ans;
  set<int> s, s2;
  cin >> k >> n;
  int a[k], b[n], dp[k];
  for (i = 0; i <= k - 1; i++) cin >> a[i];
  for (i = 0; i <= n - 1; i++) cin >> b[i];
  dp[0] = a[0];
  for (i = 1; i <= k - 1; i++) dp[i] = dp[i - 1] + a[i];
  for (i = 0; i <= k - 1; i++) s.insert(b[0] - dp[i]);
  ans = 0;
  set<int>::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    for (j = 0; j <= k - 1; j++) s2.insert(*it + dp[j]);
    for (j = 0; j <= n - 1; j++) {
      if (s2.find(b[j]) == s2.end()) break;
    }
    if (j == n) ans++;
    s2.clear();
  }
  cout << ans << endl;
}
