#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 998244353;
const long long SQ = 330;
long long p[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long second = 0;
  for (long long i = n; i > n - k; i--) {
    second += i;
  }
  cout << second << ' ';
  long long ans = 1;
  vector<long long> v;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    if (p[i] > n - k) v.push_back(i);
  }
  for (int i = 0; i < v.size() - 1; i++) {
    ans *= v[i + 1] - v[i];
    ans %= Mod;
  }
  cout << ans;
  return (0);
}
