// Arup Guha
// 5/8/2020
// Solution to Kattis Problem: Alice in a Digital World (originally from 2016 Asia Nha Trang Regional Contest)

#include <stdio.h>
#include <stdlib.h>

int go(int* arr, int idx, int len);

int main(void) {

    int numCases;
    scanf("%d", &numCases);

    // Process each case.
    for (int loop=0; loop<numCases; loop++) {

        int len, min;
        scanf("%d%d", &len, &min);

        // Allocate space.
        int* vals = malloc(len*sizeof(int));

        // Read in values.
        for (int i=0; i<len; i++)
            scanf("%d", vals+i);

        int res = min;

        // Try each possible location for min.
        for (int i=0; i<len; i++) {
            if (vals[i] == min) {
                int tmp = go(vals,i,len);
                if (tmp > res) res = tmp;
            }
        }

        // Print the best.
        printf("%d\n", res);

        // Free space.
        free(vals);
    }

    return 0;
}

// Returns the sum of the longest consecutive streak of values containing index idx, where this
// value is the unique minimum.
int go(int* arr, int idx, int len) {

    // Sweep left from idx.
    int sumLeft = 0;
    int i = idx-1;
    while (i >= 0 && arr[i] > arr[idx]) {
        sumLeft += arr[i];
        i--;
    }

    // And right.
    int sumRight = arr[idx];
    i = idx+1;
    while (i < len && arr[i] > arr[idx]) {
        sumRight += arr[i];
        i++;
    }

    // Ta da!
    return sumLeft + sumRight;
}
