#include <bits/stdc++.h>   using namespace std;   int day[13] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};   int sec, n, k, dd, mm, h, s, m, now;   string str;   queue<int> q;   int main() {     cin >> sec >> k;     getline(cin, str);     while (scanf( 2012-%d-%d %d:%d:%d: , &mm, &dd, &h, &m, &s) != EOF) {       getline(cin, str);       now = (day[mm - 1] + dd - 1) * 24 * 60 * 60 + h * 60 * 60 + m * 60 + s;       q.push(now);       while (q.front() + sec <= now) q.pop();       if (q.size() >= k) {         printf( 2012-%02d-%02d %02d:%02d:%02d , mm, dd, h, m, s);         return 0;       }     }     cout << -1 << endl;     fclose(stdout);     return 0;   }   