#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 3e5, M = N;
void solve() {
  long long i, j, n, m;
  long long k;
  cin >> n >> k;
  vector<long long> nums(n);
  for (i = 0; i < n; i++) {
    cin >> nums[i];
  }
  long long mx = 0;
  long long mn = n;
  for (long long i = n; i >= n - (k - 1); i--) {
    mx += i;
    mn = min(mn, i);
  }
  std::vector<long long> spaces;
  i = 0;
  while (i < n && nums[i] < mn) {
    i++;
  }
  while (i < n) {
    if (nums[i] >= mn) {
      i++;
      long long count = 0;
      while (i < n && nums[i] < mn) {
        count++;
        i++;
      }
      if (i == n) break;
      spaces.push_back(count);
    }
  }
  long long ans = 1;
  for (auto i : spaces) {
    ans = (ans * (i + 1)) % 998244353;
  }
  cout << mx << ' ' << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
