#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long p[n];
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    if (p[i] >= n - k + 1 && p[i] <= n) v.push_back(i);
  }
  long long sum = 0, pr = 1;
  ;
  for (int i = n - k + 1; i <= n; i++) {
    sum += i;
  }
  cout << sum << " ";
  for (int i = 0; i < v.size() - 1; i++) {
    pr = pr * (v[i + 1] - v[i]);
    pr %= MOD;
  }
  cout << pr;
}
