#include <bits/stdc++.h>
using namespace std;
int main() {
  unordered_map<long long int, long long int> mp;
  int counter[2004] = {0};
  long long int cs[2005] = {0}, arr[2005] = {0}, n, k, tally[2005] = {0};
  cin >> n >> k;
  cin >> arr[1];
  cs[1] = arr[2];
  for (int i = 2; i <= n; i++) {
    cin >> arr[i];
    cs[i] = cs[i - 1] + arr[i];
  }
  int s = 0;
  unordered_map<long long int, long long int> mp2;
  for (int i = 1; i <= k; i++) {
    cin >> tally[i];
    mp[tally[i]]++;
    mp2[tally[i]] = mp[tally[i]];
  }
  long long int e = tally[1];
  long long int ans = 0, cnt = 0;
  map<long long int, long long int> st;
  for (int i = 1; i <= n; i++) {
    e = tally[1] - cs[i];
    cnt = 0;
    if (st[e] == 1) continue;
    for (int j = 1; j <= n; j++) {
      if (mp2[e + cs[j]] != 0) {
        cnt++;
        mp2[e + cs[j]]--;
      }
    }
    st[e]++;
    if (cnt == k) ans++;
    for (int i = 1; i <= k; i++) mp2[tally[i]] = mp[tally[i]];
  }
  cout << ans << endl;
}
