#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  int ans = 0;
  unordered_set<int> pref_sums;
  int curr_sum = 0;
  while (k--) {
    int x;
    cin >> x;
    curr_sum += x;
    pref_sums.insert(curr_sum);
  }
  unordered_set<int> r;
  while (n--) {
    int x;
    cin >> x;
    r.insert(x);
  }
  for (int p : pref_sums) {
    int i = *begin(r) - p;
    bool check = true;
    for (int e : r) {
      if (!count(pref_sums.begin(), pref_sums.end(), e - i)) {
        check = false;
        break;
      }
    }
    if (check) ans++;
  }
  cout << ans << "\n";
}
