#include <bits/stdc++.h>
using namespace std;
void read_and_solve() {
  long long int n = ({
    long long int a;
    scanf("%lld", &a);
    a;
  }),
                k = ({
                  long long int a;
                  scanf("%lld", &a);
                  a;
                }),
                i, j;
  vector<long long int> v;
  for (i = 0; i < n; i++) {
    string s = ({
      string st;
      cin >> st;
      st;
    });
    v.push_back(s.size());
  }
  string st = ({
    string st;
    cin >> st;
    st;
  });
  sort(v.begin(), v.end());
  long long int d = 0, p = 0;
  for (i = 0; i < n; i++) {
    if (st.size() == v[i]) {
      d = i + 1;
      break;
    }
  }
  for (i = 0; i < n; i++) {
    if (st.size() == v[i]) {
      p = i + 1;
    }
  }
  if (d % k == 0)
    cout << d + 5 * ((d / k) - 1);
  else
    cout << d + 5 * ((d / k));
  if (p % k == 0)
    cout << " " << p + 5 * ((p / k) - 1) << endl;
  else
    cout << " " << p + 5 * ((p / k)) << endl;
}
int main() {
  read_and_solve();
  return 0;
}
