#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1;
  sum = 0, sum1 = 1, flag = -1;
  cin >> n >> k;
  long long a[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] >= n - k + 1) {
      sum += a[i];
      if (flag != -1) {
        sum1 *= (i - flag);
        sum1 = sum1 % 998244353;
      }
      flag = i;
    }
  }
  cout << sum << " " << sum1 << endl;
}
