#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  int a[k + 1];
  for (int i = 1; i <= k; i++) {
    int mark;
    cin >> mark;
    a[i] = a[i - 1] + mark;
  }
  set<int> possible;
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    set<int> intermediate;
    for (int j = 1; j <= k; j++) {
      int x = b - a[j];
      if (!i || possible.find(x) != possible.end()) {
        intermediate.insert(x);
      }
    }
    possible = intermediate;
  }
  cout << possible.size() << "\n";
  return 0;
}
