#include <bits/stdc++.h>
using namespace std;
const int T = 300001;
const long long MAX = 1000000001;
long long n, m, k;
bool check(string s) {
  for (int i = (int)0; i <= (int)s.length() - 1; i++) {
    if (s[i] == '0') return true;
  }
  return false;
}
int main() {
  int ans = 0;
  int cu = 0;
  cin >> m >> n;
  for (int i = (int)0; i <= (int)n - 1; i++) {
    string s;
    cin >> s;
    if (check(s)) {
      cu++;
    } else {
      ans = max(ans, cu);
      cu = 0;
    }
  }
  ans = max(ans, cu);
  cout << ans;
  return 0;
}
