#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = (long long)1e18;
constexpr long long MOD = 998244353;
struct fast_io {
  fast_io() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
  };
} fio;
signed main() {
  cout << fixed << setprecision(10);
  long long n, k;
  long long ans1 = 0, ans2 = 1;
  vector<long long> p, hoge;
  cin >> n >> k;
  p.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (long long i = 0; i < k; i++) {
    ans1 += n - i;
  }
  for (long long i = 0; i < n; i++) {
    if (p[i] > n - k) hoge.push_back(i);
  }
  for (long long i = 1; i < hoge.size(); i++) {
    ans2 *= hoge[i] - hoge[i - 1];
    ans2 %= MOD;
  }
  cout << ans1 << " " << ans2 << "\n";
  return 0;
}
