#include <bits/stdc++.h>
using namespace std;
string toYesNo(bool b) { return b ? "YES" : "NO"; }
namespace cl {
template <class K, class V>
class Map {
  std::map<K, V> map;

 public:
  bool empty() { return map.empty(); }
  typename std::map<K, V>::iterator begin() { return map.begin(); }
  typename std::map<K, V>::iterator end() { return map.end(); }
  typename std::map<K, V>::reverse_iterator rbegin() { return map.rbegin(); }
  typename std::map<K, V>::reverse_iterator rend() { return map.rend(); }
  K firstKey() {
    assert(!empty());
    return begin()->first;
  }
  V firstValue() {
    assert(!empty());
    return begin()->second;
  }
  K lastKey() {
    assert(!empty());
    return map.rbegin()->first;
  }
  V lastValue() {
    assert(!empty());
    return map.rbegin()->second;
  }
  void removeLast() { map.erase(lastKey()); }
  void removeFirst() { map.erase(firstKey()); }
  V &operator[](const K &k) { return map[k]; }
};
template <class V>
class Array {
  std::vector<V> vec;

 public:
  Array() {}
  Array(int sz) : vec(vector<V>(sz)) {}
  void resize(int sz) { vec.resize(sz); }
  void assertIndex(int index) const {
    do {
      if (!(index >= 0 && index < vec.size())) {
        std::cerr << "Assertion `"
                     "index >= 0 && index < vec.size()"
                     "` failed in "
                  << "<stdin>"
                  << " line " << 93 << ": "
                  << "Index of out bounds, size = " << size()
                  << ", index = " << index << std::endl;
        assert(false);
      }
    } while (false);
  }
  V &operator[](int index) {
    assertIndex(index);
    return vec[index];
  }
  const V &operator[](int index) const {
    assertIndex(index);
    return vec[index];
  }
  int add(const V &v) {
    vec.push_back(v);
    return vec.size() - 1;
  }
  typename std::vector<V>::iterator begin() { return vec.begin(); }
  typename std::vector<V>::const_iterator begin() const { return vec.begin(); }
  typename std::vector<V>::iterator end() { return vec.end(); }
  typename std::vector<V>::const_iterator end() const { return vec.end(); }
  int size() const { return vec.size(); }
  V &last() { return this[size() - 1]; }
  V &first() { return this[0]; }
  bool empty() { return size() == 0; }
  friend std::ostream &operator<<(std::ostream &stream, const Array<V> &array) {
    bool first = true;
    stream << "Array of " << array.size() << ": [";
    for (auto &v : array) {
      if (!first) {
        stream << ", ";
      }
      first = false;
      stream << v;
    }
    stream << "]";
    return stream;
  }
};
template <class V>
class Array1 : public Array<V> {
 public:
  Array1() {}
  Array1(int sz) : Array<V>(sz) {}
  V &operator[](int index) { return Array<V>::operator[](index - 1); }
  const V &operator[](int index) const {
    return Array<V>::operator[](index - 1);
  }
};
template <class V>
class ArrayR : public Array<V> {
  int minIndex, maxIndex;

 public:
  ArrayR() {}
  ArrayR(int minIndex, int maxIndex)
      : Array<V>(maxIndex - minIndex + 1),
        minIndex(minIndex),
        maxIndex(maxIndex) {
    assert(minIndex <= maxIndex);
    assert(Array<V>::size() == (maxIndex - minIndex + 1));
  }
  V &operator[](int index) { return Array<V>::operator[](index - minIndex); }
  const V &operator[](int index) const {
    return Array<V>::operator[](index - minIndex);
  }
};
}  // namespace cl
namespace math {
template <class T>
T power(const T &a, int n) {
  assert(n >= 1);
  if (n == 1) {
    return a;
  } else if (n % 2 == 0) {
    T tmp = power(a, n / 2);
    return tmp * tmp;
  } else {
    return a * power(a, n - 1);
  }
}
template <class T>
class DefaultCalculator {
 public:
  static T zero() { return 0; }
  static T plus(const T &a, const T &b) { return a + b; }
  static T multiply(const T &a, const T &b) { return a * b; }
  static T subtract(const T &a, const T &b) { return a - b; }
  static T divide(const T &a, const T &b) { return a / b; }
};
}  // namespace math
template <class T, class Calc = math::DefaultCalculator<T>>
class Matrix {
  cl::Array1<cl::Array1<T>> a;
  int nRow, nCol;

 public:
  void init(int nRow, int nCol) {
    this->nRow = nRow;
    this->nCol = nCol;
    a.resize(nRow);
    for (auto r = 1; r <= nRow; ++r) {
      a[r].resize(nCol);
      for (auto c = 1; c <= nCol; ++c) {
        a[r][c] = Calc::zero();
      }
    }
  }
  void init(int nRow, int nCol, const cl::Array1<cl::Array1<T>> &val) {
    assert(val.size() == nRow);
    assert(val[1].size() == nCol);
    init(nRow, nCol);
    for (auto r = 1; r <= nRow; ++r) {
      for (auto c = 1; c <= nCol; ++c) {
        a[r][c] = val[r][c];
      }
    }
  }
  void init(const cl::Array1<cl::Array1<T>> &val) {
    init(val.size(), val[1].size(), val);
  }
  Matrix &operator=(const cl::Array1<cl::Array1<T>> &val) {
    init(val);
    return *this;
  }
  Matrix operator+(const Matrix &o) const {
    assert(nRow == o.nRow);
    assert(nCol == o.nCol);
    Matrix ret;
    ret.init(nRow, nCol);
    for (auto r = 1; r <= nRow; ++r)
      for (auto c = 1; c <= nCol; ++c)
        ret.a[r][c] = Calc::plus(a[r][c], o.a[r][c]);
    return ret;
  }
  Matrix operator*(const Matrix &o) const {
    assert(nCol == o.nRow);
    Matrix ret;
    ret.init(nRow, o.nCol);
    for (auto r = 1; r <= nRow; ++r)
      for (auto c2 = 1; c2 <= nCol; ++c2)
        if (a[r][c2] != Calc::zero())
          for (auto c = 1; c <= o.nCol; ++c) {
            ret.a[r][c] =
                Calc::plus(ret.a[r][c], Calc::multiply(a[r][c2], o.a[c2][c]));
          }
    return ret;
  }
  Matrix power(int k) const { return math::power(*this, k); }
  cl::Array1<T> &operator[](int r) { return a[r]; }
  friend std::ostream &operator<<(std::ostream &stream, const Matrix &matrix) {
    stream << "[matrix: row = " << matrix.nRow << ", col = " << matrix.nCol
           << endl;
    for (auto r = 1; r <= matrix.nRow; ++r) {
      for (auto c = 1; c <= matrix.nCol; ++c) {
        stream << matrix.a[r][c] << " ";
      }
      stream << endl;
    }
    stream << "]" << endl;
    return stream;
  }
};
template <class T, class Calc = math::DefaultCalculator<T>>
class UpperTriMatrix {
  cl::Array1<cl::ArrayR<T>> a;
  int size;

 public:
  void init(int size) {
    this->size = size;
    this->size = size;
    a.resize(size);
    for (auto r = 1; r <= size; ++r) {
      a[r] = cl::ArrayR<T>(r, size);
      for (auto c = r; c <= size; ++c) {
        a[r][c] = Calc::zero();
      }
    }
  }
  UpperTriMatrix operator+(const UpperTriMatrix &o) const {
    assert(size == o.size);
    UpperTriMatrix ret;
    ret.init(size);
    for (auto r = 1; r <= size; ++r)
      for (auto c = r; c <= size; ++c)
        ret.a[r][c] = Calc::plus(a[r][c], o.a[r][c]);
    return ret;
  }
  UpperTriMatrix operator*(const UpperTriMatrix &o) const {
    assert(size == o.size);
    UpperTriMatrix ret;
    ret.init(size);
    for (auto r = 1; r <= size; ++r)
      for (auto c2 = r; c2 <= size; ++c2)
        if (a[r][c2] != Calc::zero())
          for (auto c = c2; c <= size; ++c) {
            ret.a[r][c] =
                Calc::plus(ret.a[r][c], Calc::multiply(a[r][c2], o.a[c2][c]));
          }
    return ret;
  }
  UpperTriMatrix power(int k) const { return math::power(*this, k); }
  cl::ArrayR<T> &operator[](int r) { return a[r]; }
  friend std::ostream &operator<<(std::ostream &stream,
                                  const UpperTriMatrix &matrix) {
    stream << "[UpperTriMatrix: size = " << matrix.size << endl;
    for (auto r = 1; r <= matrix.size; ++r) {
      for (auto c = r; c <= matrix.size; ++c) {
        stream << matrix.a[r][c] << " ";
      }
      stream << endl;
    }
    stream << "]" << endl;
    return stream;
  }
};
class MyCalc {
 public:
  static inline int zero() { return -1E9L; }
  static inline int plus(const int &a, const int &b) { return max(a, b); }
  static inline int multiply(const int &a, const int &b) { return a + b; }
};
class TaskB {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int n, nRepeat;
    in >> n >> nRepeat;
    cl::Array1<int> a(n);
    int maxVal = 0;
    for (auto i = 1; i <= n; ++i) {
      in >> a[i];
      maxVal = max(maxVal, a[i]);
    }
    UpperTriMatrix<int, MyCalc> base;
    base.init(maxVal);
    for (auto lower = 1; lower <= maxVal; ++lower)
      for (auto upper = lower; upper <= maxVal; ++upper) {
        base[lower][upper] = 0;
      }
    for (auto lower = 1; lower <= maxVal; ++lower) {
      cl::Array1<int> longestEnd(n);
      for (auto i = 1; i <= n; ++i)
        if (a[i] >= lower) {
          longestEnd[i] = 1;
          for (auto j = 1; j <= i - 1; ++j) {
            if (a[j] >= lower && a[j] <= a[i]) {
              longestEnd[i] = max(longestEnd[i], longestEnd[j] + 1);
            }
          }
        }
      for (auto i = 1; i <= n; ++i)
        if (a[i] >= lower) {
          for (auto upper = a[i]; upper <= maxVal; ++upper) {
            base[lower][upper] =
                MyCalc::plus(base[lower][upper], longestEnd[i]);
          }
        }
    }
    base = base.power(nRepeat);
    int best = 0;
    for (auto lower = 1; lower <= maxVal; ++lower) {
      for (auto upper = lower; upper <= maxVal; ++upper) {
        best = MyCalc::plus(best, base[lower][upper]);
      }
    }
    out << best << endl;
  }
};
int main() {
  TaskB solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
