#include <bits/stdc++.h>
using namespace std;
int findCount(vector<int> juryMarks, set<int> rememberedPoints) {
  int count = 0;
  set<int> values;
  vector<int> differencesFromStart;
  differencesFromStart.push_back(juryMarks[0]);
  for (int i = 1; i < juryMarks.size(); i++) {
    differencesFromStart.push_back(differencesFromStart[i - 1] + juryMarks[i]);
  }
  int fixedValue = *rememberedPoints.begin();
  for (int i = 0; i < juryMarks.size(); i++) {
    int initialValue = fixedValue - differencesFromStart[i];
    set<int> rememberedPointsCp = rememberedPoints;
    rememberedPointsCp.erase(fixedValue);
    for (int j = 0; j < juryMarks.size(); j++) {
      int currentValue = initialValue + differencesFromStart[j];
      rememberedPointsCp.erase(currentValue);
    }
    if (rememberedPointsCp.size() == 0) {
      values.insert(initialValue);
    }
  }
  return values.size();
}
int main() {
  int k, n;
  cin >> k >> n;
  vector<int> juryMarks;
  for (int i = 0; i < k; i++) {
    int current;
    cin >> current;
    juryMarks.push_back(current);
  }
  set<int> rememberedPoints;
  for (int i = 0; i < n; i++) {
    int current;
    cin >> current;
    rememberedPoints.insert(current);
  }
  cout << findCount(juryMarks, rememberedPoints) << endl;
}
