Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered from 1 to n, from left to right. The position of a cell at row r and column c is represented as (r, c). There are only two colors for the cells in cfpaint — black and white.

There is a tool named eraser in cfpaint. The eraser has an integer size k (1 ≤ k ≤ n). To use the eraser, Gildong needs to click on a cell (i, j) where 1 ≤ i, j ≤ n - k + 1. When a cell (i, j) is clicked, all of the cells (i', j') where i ≤ i' ≤ i + k - 1 and j ≤ j' ≤ j + k - 1 become white. In other words, a square with side equal to k cells and top left corner at (i, j) is colored white.

A white line is a row or a column without any black cells.

Gildong has worked with cfpaint for some time, so some of the cells (possibly zero or all) are currently black. He wants to know the maximum number of white lines after using the eraser exactly once. Help Gildong find the answer to his question.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 2000) — the number of rows and columns, and the size of the eraser.

The next n lines contain n characters each without spaces. The j-th character in the i-th line represents the cell at (i,j). Each character is given as either 'B' representing a black cell, or 'W' representing a white cell.

Output

Print one integer: the maximum number of white lines after using the eraser exactly once.

Examples

Input


4 2
BWWW
WBBW
WBBW
WWWB


Output


4


Input


3 1
BWB
WWB
BWB


Output


2


Input


5 3
BWBBB
BWBBB
BBBBB
BBBBB
WBBBW


Output


2


Input


2 2
BW
WB


Output


4


Input


2 1
WW
WW


Output


4

Note

In the first example, Gildong can click the cell (2, 2), then the working screen becomes: 
    
    
    BWWW  
    WWWW  
    WWWW  
    WWWB  
    

Then there are four white lines — the 2-nd and 3-rd row, and the 2-nd and 3-rd column.

In the second example, clicking the cell (2, 3) makes the 2-nd row a white line.

In the third example, both the 2-nd column and 5-th row become white lines by clicking the cell (3, 2).
import java.io.*;
import java.math.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.Comparator.*;

public class Main {
    FastScanner in;
    PrintWriter out;
    ArrayList<Integer>[] graph;
    ArrayList<GraphPair>[] weightedGraph;
    long mod = (long) 1e9 + 7; // 998_244_353L || (long) 1e9 + 9
    boolean multitests = false;

    private void solve() throws IOException {
        // solveA();
        // solveB();
        // solveC();
        solveD();
        // solveE();
        // solveF();
    }

    private void solveA() throws IOException {
        in.next();
        boolean[] used = new boolean[10];
        for (char c : in.next().toCharArray())
            if (c == 'L') {
                for (int i = 0; i < 10; i++) {
                    if (!used[i]) {
                        used[i] = true;
                        break;
                    }
                }
            } else if (c == 'R') {
                for (int i = 9; i >= 0; i--) {
                    if (!used[i]) {
                        used[i] = true;
                        break;
                    }
                }
            } else
                used[c - '0'] = false;

        for (int i = 0; i < 10; i++)
            out.print(used[i] ? 1 : 0);
    }

    private void solveB() throws IOException {
        int n = in.nextInt();
        long m = in.nextLong(), k = in.nextLong();
        long[] h = in.nextLongArray(n);
        for (int i = 0; i < n - 1; i++) {
            if (h[i] > max(0, h[i + 1] - k)) {
                m += h[i] - max(0, h[i + 1] - k);
            } else if (h[i] < h[i + 1] - k) {
                m -= h[i + 1] - k - h[i];
                if (m < 0) {
                    out.println("NO");
                    return;
                }
            }
        }
        out.println("YES");
    }

    private void solveC() throws IOException {
        long n = in.nextLong(), m = in.nextLong();
        long gcd = gcd(n, m);
        int q = in.nextInt();
        while (q-- > 0) {
            long sx = in.nextLong(), sy = in.nextLong() - 1;
            long ex = in.nextLong(), ey = in.nextLong() - 1;
            if ((sx == 1 ? sy / (n / gcd) : sy / (m / gcd)) == (ex == 1 ? ey / (n / gcd) : ey / (m / gcd)))
                out.println("YES");
            else
                out.println("NO");
        }
    }

    private void solveD() throws IOException {
        int n = in.nextInt(), k = in.nextInt();
        int[] maxI = new int[n], minI = new int[n];
        int[] maxJ = new int[n], minJ = new int[n];
        fill(maxI, -1);
        fill(minI, n + 1);
        fill(maxJ, -1);
        fill(minJ, n + 1);
        for (int i = 0; i < n; i++) {
            char[] s = in.next().toCharArray();
            for (int j = 0; j < n; j++) {
                if (s[j] == 'B') {
                    minI[i] = min(minI[i], j);
                    maxI[i] = max(maxI[i], j);
                    minJ[j] = min(minJ[j], i);
                    maxJ[j] = max(maxJ[j], i);
                }
            }
        }

        int answer = 0;
        int[][] ansI = new int[n][n];
        for (int i = 0; i < n; i++) {
            if (minI[i] > maxI[i])
                answer++;
            else if (maxI[i] - minI[i] + 1 > k)
                continue;
            else {
                int add = k - (maxI[i] - minI[i] + 1);
                for (int j = 0; j < k && i - j >= 0; j++) {
                    ansI[i - j][max(0, minI[i] - add)]++;
                    if (minI[i] + 1 < n)
                        ansI[i - j][minI[i] + 1]--;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 1; j < n; j++) {
                ansI[i][j] += ansI[i][j - 1];
            }
        }

        int[][] ansJ = new int[n][n];
        for (int j = 0; j < n; j++) {
            if (minJ[j] > maxJ[j])
                answer++;
            else if (maxJ[j] - minJ[j] + 1 > k)
                continue;
            else {
                int add = k - (maxJ[j] - minJ[j] + 1);
                for (int i = 0; i < k && j - i >= 0; i++) {
                    ansJ[max(0, minJ[j] - add)][j - i]++;
                    if (minJ[j] + 1 < n)
                        ansJ[minJ[j] + 1][j - i]--;
                }
            }
        }
        for (int j = 0; j < n; j++) {
            for (int i = 1; i < n; i++) {
                ansJ[i][j] += ansJ[i - 1][j];
            }
        }

        int max = 0;
        for (int i = 0; i < n - k + 1; i++) {
            for (int j = 0; j < n - k + 1; j++) {
                max = max(max, ansI[i][j] + ansJ[i][j]);
            }
        }
        out.println(answer+max);
    }

    private void solveE() throws IOException {

    }

    private void solveF() throws IOException {

    }

    void shuffleInt(int[] a) {
        Random random = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int j = random.nextInt(i + 1);
            int swap = a[j];
            a[j] = a[i];
            a[i] = swap;
        }
    }

    void shuffleLong(long[] a) {
        Random random = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int j = random.nextInt(i + 1);
            long swap = a[j];
            a[j] = a[i];
            a[i] = swap;
        }
    }

    void reverseInt(int[] a) {
        for (int i = 0, j = a.length - 1; i < j; i++, j--) {
            int swap = a[i];
            a[i] = a[j];
            a[j] = swap;
        }
    }

    void reverseLong(long[] a) {
        for (int i = 0, j = a.length - 1; i < j; i++, j--) {
            long swap = a[i];
            a[i] = a[j];
            a[j] = swap;
        }
    }

    int maxInt(int[] a) {
        int max = a[0];
        for (int i = 1; i < a.length; i++)
            if (max < a[i])
                max = a[i];
        return max;
    }

    long maxLong(long[] a) {
        long max = a[0];
        for (int i = 1; i < a.length; i++)
            if (max < a[i])
                max = a[i];
        return max;
    }

    int minInt(int[] a) {
        int min = a[0];
        for (int i = 1; i < a.length; i++)
            if (min > a[i])
                min = a[i];
        return min;
    }

    long minLong(long[] a) {
        long min = a[0];
        for (int i = 1; i < a.length; i++)
            if (min > a[i])
                min = a[i];
        return min;
    }

    long sumInt(int[] a) {
        long s = 0;
        for (int i = 0; i < a.length; i++)
            s += a[i];
        return s;
    }

    long sumLong(long[] a) {
        long s = 0;
        for (int i = 0; i < a.length; i++)
            s += a[i];
        return s;
    }

    long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    long binpowmod(long a, long n) {
        long res = 1;
        a %= mod;
        n %= mod - 1;
        while (n > 0) {
            if (n % 2 == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            n /= 2;
        }
        return res;
    }

    class GraphPair implements Comparable<GraphPair> {
        int v;
        long w;

        GraphPair(int v, long w) {
            this.v = v;
            this.w = w;
        }

        public int compareTo(GraphPair o) {
            return w != o.w ? Long.compare(w, o.w) : Integer.compare(v, o.v);
        }
    }

    ArrayList<Integer>[] createGraph(int n) throws IOException {
        ArrayList<Integer>[] graph = new ArrayList[n];
        for (int i = 0; i < n; i++)
            graph[i] = new ArrayList<>();
        return graph;
    }

    ArrayList<GraphPair>[] createWeightedGraph(int n) throws IOException {
        ArrayList<GraphPair>[] graph = new ArrayList[n];
        for (int i = 0; i < n; i++)
            graph[i] = new ArrayList<>();
        return graph;
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s), 32768);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = in.nextInt();
            return a;
        }

        int[][] nextIntTable(int n, int m) throws IOException {
            int[][] a = new int[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    a[i][j] = in.nextInt();
            return a;
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = in.nextLong();
            return a;
        }

        long[][] nextLongTable(int n, int m) throws IOException {
            long[][] a = new long[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    a[i][j] = in.nextLong();
            return a;
        }

        ArrayList<Integer>[] nextGraph(int n, int m, boolean directed) throws IOException {
            ArrayList<Integer>[] graph = createGraph(n);
            for (int i = 0; i < m; i++) {
                int v = in.nextInt() - 1, u = in.nextInt() - 1;
                graph[v].add(u);
                if (!directed)
                    graph[u].add(v);
            }
            return graph;
        }

        ArrayList<GraphPair>[] nextWeightedGraph(int n, int m, boolean directed) throws IOException {
            ArrayList<GraphPair>[] graph = createWeightedGraph(n);
            for (int i = 0; i < m; i++) {
                int v = in.nextInt() - 1, u = in.nextInt() - 1;
                long w = in.nextLong();
                graph[v].add(new GraphPair(u, w));
                if (!directed)
                    graph[u].add(new GraphPair(v, w));
            }
            return graph;
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }

    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        for (int t = multitests ? in.nextInt() : 1; t-- > 0; )
            solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}