#include <bits/stdc++.h>
using namespace std;
int a[2005], b[2005];
map<int, int> present;
set<int> ans;
int main() {
  int k, n;
  cin >> k >> n;
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= k; i++) {
    int init = b[1] - a[i];
    int counter = 0;
    present.clear();
    for (int j = 1; j <= n; j++) {
      present[b[j]]++;
    }
    for (int j = 1; j <= k; j++) {
      if (present[init + a[j]] > 0) {
        counter++;
        present[init + a[j]]--;
      }
    }
    if (counter >= n) ans.insert(init);
  }
  cout << (int)ans.size() << endl;
  ;
}
