#include <bits/stdc++.h>
using namespace std;
const int N = int(300000) + 5;
template <typename T, typename T1>
void prin(vector<pair<T, T1> >& a) {
  for (long long int i = 0; i <= a.size() - 1; i++) {
    cout << a[i].fi << " " << a[i].se << "\n";
  }
}
template <typename T>
void prin_new_line(vector<T>& a) {
  for (long long int i = 0; i <= a.size() - 1; i++) {
    cout << a[i] << "\n";
  }
}
template <typename T, typename T1>
void prin_new_line(vector<pair<T, T1> >& a) {
  for (long long int i = 0; i <= a.size() - 1; i++) {
    cout << a[i].fi << " " << a[i].se << "\n";
  }
}
template <typename T>
T max(vector<T>& a) {
  T ans = a[0];
  for (long long int i = 0; i <= a.size() - 1; i++) {
    ans = max(ans, a[i]);
  }
  return ans;
}
template <typename T>
T min(vector<T>& a) {
  T ans = a[0];
  for (long long int i = 0; i <= a.size() - 1; i++) {
    ans = min(ans, a[i]);
  }
  return ans;
}
template <typename T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <typename T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
long double s_triangle(long double x1, long double y1, long double x2,
                       long double y2, long double x3, long double y3) {
  return abs(((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) / 2);
}
bool overflow(long long int a, long long int b) {
  if (a * b / b != a) return true;
  return false;
}
long long int t, n, tot, ans, k, cnt;
long long int a[N], b[N], sum[N];
string s[105], p;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (long long int i = 0; i <= n - 1; i++) cin >> s[i];
  cin >> p;
  sort(s, s + n);
  for (long long int i = 0; i <= n - 1; i++) {
    a[i] = s[i].length();
    b[i] = a[i];
  }
  t = p.length();
  sort(b, b + n);
  long long int f = 0, cnt1 = 0;
  for (long long int i = 0; i <= n - 1; i++) {
    if (cnt == k) ans += 5, cnt = 0;
    ans += 1;
    cnt++;
    if (b[i] == t and f == 0) {
      tot = ans;
      f = 1;
    }
    if (b[i] == t) {
      cnt1 = ans;
    }
  }
  cout << tot << " " << cnt1 << endl;
  return 0;
}
