#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a;
  long long int sum = 0;
  for (long long int i = 1, x; i <= n; i++) {
    cin >> x;
    if (x > n - k) {
      sum += x;
      a.push_back(i);
    }
  }
  long long int ans = 1;
  for (long long int i = 0; i < a.size() - 1; i++)
    ans = (ans * (a[i + 1] - a[i])) % 998244353;
  cout << sum << " " << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int T = 1;
  for (long long int TT = 1; TT <= T; TT++) {
    solve();
  }
}
