#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k = 0, mx = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int used = 0;
    string s;
    cin >> s;
    for (int j = 0; j < n; j++) {
      if (s[j] == '0') {
        k++;
        break;
      }
      if (j == n - 1) {
        k = 0;
      }
    }
    mx = max(k, mx);
  }
  cout << mx;
}
