You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.

Input

The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 300).

Output

Print a single number — the length of a sought sequence.

Examples

Input

4 3
3 1 4 2


Output

5

Note

The array given in the sample looks like that: 3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2. The elements in bold form the largest non-decreasing subsequence. 
import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;

public class B {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	Random RG = new Random();
	Treap root;

	class Treap {
		int key, priority, d, maxD;
		Treap left, right;

		public Treap(int key, int d) {
			this.key = key;
			this.priority = RG.nextInt();
			this.d = d;
			this.maxD = d;
		}
	}

	void add(int key, int d) {
		Treap t = new Treap(key, d);
		Treap[] parts = split(root, key);
		root = merge(parts[0], merge(t, parts[1]));
	}

	int getMaxD(int notGreaterThan) {
		Treap[] parts = split(root, notGreaterThan + 1);
		int res = getMaxD(parts[0]);
		root = merge(parts[0], parts[1]);
		return res;
	}
	int getMaxD1(int notGreaterThan) {
		Treap[] parts = split(root, notGreaterThan);
		int res = getMaxD(parts[1]);
		root = merge(parts[0], parts[1]);
		return res;
	}

	void update(Treap t) {
		if (t == null) return;
		t.maxD = Math.max(getMaxD(t.left), Math.max(getMaxD(t.right), t.d));
	}

	int getMaxD(Treap t) {
		if (t == null) return 0;
		return t.maxD;
	}

	Treap[] split(Treap t, int key) {
		if (t == null) return new Treap[2];
		Treap[] res;
		if (t.key >= key) {
			res = split(t.left, key);
			t.left = res[1];
			res[1] = t;
		} else {
			res = split(t.right, key);
			t.right = res[0];
			res[0] = t;
		}
		update(res[0]);
		update(res[1]);
		return res;
	}

	Treap merge(Treap left, Treap right) {
		if (left == null) return right;
		if (right == null) return left;
		Treap res;
		if (left.priority > right.priority) {
			left.right = merge(left.right, right);
			res = left;
		} else {
			right.left = merge(left, right.left);
			res = right;
		}
		update(res);
		return res;
	}

	void solve() throws IOException {
		int n = readInt();
		int t = readInt();
		int[] a = readArr(n);
		int[] count = new int[301];
		for (int i = 0; i < n; i++) {
			count[a[i]]++;
		}
		int cur = 0;
		for (int i = 0; i <= 300; i++) {
			if (count[i] != 0) {
				for (int j = 0; j < n; j++) {
					if (a[j] == i) {
						a[j] = cur;
					}
				}
				count[cur] = count[i];
				cur++;
			}
		}

		int nn = n * n;
		int[] x = new int[nn];

		for (int i = 0; i < nn; i++) {
			x[i] = a[i % n];
		}
		int[] d = new int[nn];

		for (int i = 0; i < nn; i++) {
			d[i] = getMaxD(x[i]) + 1;
			add(x[i], d[i]);
		}

		root = null;

		int[] d1 = new int[nn];

		for (int i = nn-1; i >= 0; i--) {
			d1[i] = getMaxD1(x[i]) + 1;
			add(x[i], d1[i]);
		}

		long res = 0;
		if(t <= n) {
			for(int i = 0; i < t * n; i++) {
				res = Math.max(res, d[i]);
			}
			out.println(res);
			return;
		}
		for (int i = 0, j = nn-1; i < nn; i++, j--) {
			int curStart = d[i] + d1[i]-1;

			curStart += (t - n) * count[x[i]];
			if (res < curStart) {
				res = curStart;
			}
		}
		out.println(res);
	}


	void init() throws FileNotFoundException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	int[] readArr(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = readInt();
		}
		return res;
	}

	long[] readArrL(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = readLong();
		}
		return res;
	}

	public static void main(String[] args) {
		new B().run();
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
}