You've got a list of program warning logs. Each record of a log stream is a string in this format: 

"2012-MM-DD HH:MM:SS:MESSAGE" (without the quotes). 

String "MESSAGE" consists of spaces, uppercase and lowercase English letters and characters "!", ".", ",", "?". String "2012-MM-DD" determines a correct date in the year of 2012. String "HH:MM:SS" determines a correct time in the 24 hour format.

The described record of a log stream means that at a certain time the record has got some program warning (string "MESSAGE" contains the warning's description).

Your task is to print the first moment of time, when the number of warnings for the last n seconds was not less than m.

Input

The first line of the input contains two space-separated integers n and m (1 ≤ n, m ≤ 10000).

The second and the remaining lines of the input represent the log stream. The second line of the input contains the first record of the log stream, the third line contains the second record and so on. Each record of the log stream has the above described format. All records are given in the chronological order, that is, the warning records are given in the order, in which the warnings appeared in the program. 

It is guaranteed that the log has at least one record. It is guaranteed that the total length of all lines of the log stream doesn't exceed 5·106 (in particular, this means that the length of some line does not exceed 5·106 characters). It is guaranteed that all given dates and times are correct, and the string 'MESSAGE" in all records is non-empty.

Output

If there is no sought moment of time, print -1. Otherwise print a string in the format "2012-MM-DD HH:MM:SS" (without the quotes) — the first moment of time when the number of warnings for the last n seconds got no less than m.

Examples

Input

60 3
2012-03-16 16:15:25: Disk size is
2012-03-16 16:15:25: Network failute
2012-03-16 16:16:29: Cant write varlog
2012-03-16 16:16:42: Unable to start process
2012-03-16 16:16:43: Disk size is too small
2012-03-16 16:16:53: Timeout detected


Output

2012-03-16 16:16:43


Input

1 2
2012-03-16 23:59:59:Disk size
2012-03-17 00:00:00: Network
2012-03-17 00:00:01:Cant write varlog


Output

-1


Input

2 2
2012-03-16 23:59:59:Disk size is too sm
2012-03-17 00:00:00:Network failute dete
2012-03-17 00:00:01:Cant write varlogmysq


Output

2012-03-17 00:00:00
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;

/**
 * @author Roman Dzhadan
 * @E-Mail dflash36@gmail.com
 * @Skype ronex36
 */

public class Main {

    public static IO type = IO.STANDART;

    public static int MEMORY_LIMIT = 256;
    public static int TIME_LIMIT = 2;

    public static String inputFileName = "input.txt";
    public static String outputFileName = "output.txt";

    public static InputReader in;
    public static OutputWriter out;

    public static void main(String[] args) throws IOException {
        configure();
        Task task = new Task();
        task.solve(in, out);
        out.close();
    }

    private static void configure() {
        if (type == IO.FILE) {
            try {
                InputStream fileIn = new FileInputStream(
                        new File(inputFileName));
                OutputStream fileOut = new FileOutputStream(new File(
                        outputFileName));
                in = new InputReader(fileIn);
                out = new OutputWriter(fileOut);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        if (type == IO.STANDART) {
            try {
                InputStream stdIn = System.in;
                OutputStream stdOut = System.out;
                in = new InputReader(stdIn);
                out = new OutputWriter(stdOut);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

/* Your solution starts here: */
class Task {

    public void solve(InputReader in, OutputWriter out) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int n = Integer.parseInt(line.split(" ")[0]);
        int m = Integer.parseInt(line.split(" ")[1]);
        
        String log;
        
        List <Long> events = new ArrayList<Long>();
        List<String>answer = new ArrayList<String>();
        
        
        while ((log = br.readLine()) != null) {
            String date = log.split(" ")[0];
            String time = log.split(" ")[1];
            String[]tmp = time.split(":");
            time = tmp[0] + ":" + tmp[1] + ":" + tmp[2];
            events.add(getTime(date, time));
            answer.add(date + " " + time);
        }
        
        System.err.println("Size = " + answer.size());
        
        try {
            
            for (int i = 0; i < events.size(); i++) {
                long first = events.get(i);
                long last = events.get(i + m - 1);
                if (last - first < n * 1000) {
                    System.out.println(answer.get(i + m - 1));
                    return;
                }
            }
            
        }
        catch (Exception e) {
            System.out.println(-1);
        }
    }
    
    public long getTime(String date, String time) {
        String[]tmp = date.split("-");
        String[]tmp2 = time.split(":");
        Date d = new Date();
        d.setYear(Integer.parseInt(tmp[0]));
        d.setMonth(Integer.parseInt(tmp[1]) - 1);
        d.setDate(Integer.parseInt(tmp[2]));
        d.setHours(Integer.parseInt(tmp2[0]));
        d.setMinutes(Integer.parseInt(tmp2[1]));
        d.setSeconds(Integer.parseInt(tmp2[2]));
        return d.getTime();
    }
    
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    private String readLine0() {
        StringBuilder buf = new StringBuilder();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

class Utils {

    public static long MOD = 1000 * 1000 * 1000 + 9;

    public static boolean[] getEratosfenSieve(int size) {
        boolean[] prime = new boolean[size + 1];
        Arrays.fill(prime, true);
        prime[0] = prime[1] = false;
        for (int i = 2; i <= size; ++i)
            if (prime[i])
                if (i * 1L * i <= size * 1L)
                    for (int j = i * i; j <= size; j += i)
                        prime[j] = false;
        return prime;
    }

    public static int getCodeGray(int n) {
        return n ^ (n >> 1);
    }

    public static int gcd(int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    public static int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    public static long binPower(long base, long exponent, long mod) {
        if (exponent == 0)
            return 1;
        long result = binPower(base, exponent >> 1, mod);
        result = result * result % mod;
        if ((exponent & 1) != 0)
            result = result * base % mod;
        return result;
    }
}

enum IO {
    FILE, STANDART
}